Php programming connection Database read data table problem my database has multiple data tables, only the table order can not read & nbsp; can only print 111 any other table can & nbsp; the error "QAQ & nbsp; & lt;?" is displayed ;? Php & nbsp; $ cornmysql_co php programming connection to the database to read data tables
My database has multiple data tables. only the table order cannot be read, and only 111 is printed.
Any other table can print 222
I don't know what's wrong with QAQ
$ Corn = mysql_connect ('localhost', 'root ','');
Mysql_query ('set names utf8', $ corn );
If (! $ Corn)
Die ('could not connect: '. mysql_error ());
$ Db_selected = mysql_select_db ("daydream", $ corn );
If (! $ Db_selected)
Die ('Can \'t use foo: '. mysql_error ());
$ Query = mysql_query ("select * from order ");
If (! $ Query) echo 111;
Else echo 222; // these three rows are used to test whether the data table is read.
$ Row = mysql_fetch_array ($ query );
Echo"
CartNo: $ row [cartNo]
Customer No.: $ row [cusNo]
Product No.: $ row [proNo]
Purchase Time: $ row [cartDate]
Purchase Amount: $ row [cartSum]
Shipping Address: $ row [cartAddress]
";
Echo"
";
?>
------ Solution --------------------
$ Query = mysql_query ("select * from order ");
Order is the word
Change
$ Query = mysql_query ("select * from 'order '");
You can.
In fact, table names are generally not better than orders, but can be done using orders.
------ Solution --------------------
$query=mysql_query("select * from `order` ");
------ Solution --------------------
I know that the table name cannot use keywords.
However, if you have a keyword, you must use.
------ Solution --------------------
Only the table order cannot be read. only 111 rows can be printed.
Any other table can print 222. In fact, you already know the problem from your description, that is, the order table problem. what is the problem? like the keyword order, so change the table name or 'order'
------ Solution --------------------
Mysql reserved word http://www.cnblogs.com/lawdong/archive/2010/08/08/2357903.html
Do not escape any reserved words when they are used as other words: enclose them''
The following reserved words can be used as exceptions:
ACTION
BIT
DATE
ENUM
NO
TEXT
TIME
TIMESTAMP