Could you please help me see how this PHP mysql reading interface cannot read data ??? This is the CREATETABLEIFNOTEXISTS 'TM _ comment' ('playerid' textNOTNULL, 'message' textNOTNULL, 'color' textNOTNULL, 'fontsize' varchar (3) NO. could you please help me see how this PHP mysql reading interface cannot read data ???
This is for creating a database
Create table if not exists 'TM _ comment '(
'Playerid' text not null,
'Message' text not null,
'Color' text not null,
'Fontsize' varchar (3) not null,
'Mode' varchar (2) not null,
'Playtime' varchar (4) not null,
'Date' text NOT NULL
) ENGINE = InnoDB default charset = utf8;
This is the write interface
$ Vid = $ _ POST ['playerid'];
$ Message = $ _ POST ['message'];
$ Color = $ _ POST ['color'];
$ Fontsize = $ _ POST ['fontsize'];
$ Mode = $ _ POST ['mode'];
$ Playtime = $ _ POST ['playtime'];
$ Date = $ _ POST ['Date'];
$ Conn = mysql_connect ("localhost", "root", "root ");
Mysql_query ("set names 'utf8'", $ conn );
Mysql_select_db ("ultrax", $ conn );
$ Exec = "insert into 'TM _ comment' ('playerid', 'message', 'Color', 'fontsize', 'mode', 'playtime', 'date ') VALUES ('$ vid',' $ message', '$ color',' $ fontsize ',' $ mode', '$ playtime',' $ date ')";
$ Result = mysql_query ($ exec, $ conn );
Mysql_close ($ conn );
?>
In this case
Header ('content-Type: text/xml ;');
$ Id = $ _ GET ['id'];
$ Link = mysql_connect ("localhost", "root", "root ");
Mysql_select_db ("ultrax", $ link );
$ Q = "SELECT * FROM 'TM _ comment' WHERE playerID = $ id ";
Mysql_query ("set names utf8 ");
$ Rs = mysql_query ($ q, $ link );
If (! $ Rs) {die ("Valid result! ");}
Echo" \ N ";
Echo" \ N ";
While ($ row = mysql_fetch_row ($ rs ))
Echo" $ Row [5] $ Row [1] $ Row [6] \ N ";
Echo" ";
Mysql_free_result ($ rs );
?>
Now there is a problem, my interface
Ability to write data
But it cannot be read (I have not written the wrong database IP address, user name, password, and database name)
------ Solution --------------------
$ Id = $ _ GET ['id'];
It is impossible to obtain the id here, because your database does not have the id column.
------ Solution --------------------
$ Q = "SELECT * FROM 'TM _ comment' WHERE playerID = '$ ID '";
Because 'playerid' text not null,
------ Solution --------------------
Positive solution... How to set the id to text? Use INT ..
Discussion
$ Q = "SELECT * FROM 'TM _ comment' WHERE playerID = '$ ID '";
Because 'playerid' text not null,
------ Solution --------------------
Fainted! Only when an error occurred in the data type was found !~~~