What error codes does the code for inserting SQL statements have? PHP code written in DW & lt ;! DOCTYPEhtmlPUBLIC & quot;-W3CDTDXHTML1.0TransitionalEN & quot; www. w3.orgTRxhtml1DTDxhtml1-transitional. dtd & quot; & gt; & lt; what error code does this insert SQL?
PHP code written in DW
Untitled Document
Mysql_connect ('localhost', 'root', '123 ');
Mysql_query ("set names gbk ");
Mysql_select_db ('test ');
Insert into 'test'. 'votes '(
'Id ',
'Sport ',
'Ballot'
)
VALUES (
'4', 'table tennis ', '0'
)
?>
Why is an error always reported:
Parse error: syntax error, unexpected 'into' (T_STRING) in C: \ xampp \ htdocs \ toupiaopiao \ result. php on line 15
------ Solution --------------------
This code is incorrect, buddy. insert into is an SQL statement. how can I write it like this directly?
$ SQL = "insert ...";
Mysql_query ($ SQL, $ conn); // conn is the linked object $ conn = mysql_connect ('localhost', 'root', '123 ');
SQL statement correctness can be determined directly in the database
------ Solution --------------------
$ SQL = <SQL
Insert into 'test'. 'votes '(
'Id ',
'Sport ',
'Ballot'
)
VALUES (
'4', 'table tennis ', '0'
)
SQL;
Mysql_query ($ SQL );
------ Solution --------------------
PHP code