Parseerror: syntaxerror, unexpectedT_VARIABLEonline9 what is the problem? My code is as follows: & lt ;? Echo $ _ POST [username]; echo $ _ POST [password]; echo $ _ POST [mailbox]; $ mysql_server_name Parse error: syntax error, unexpected T_VARIABLE on line 9
What is the problem? My code is as follows:
Echo $ _ POST ['username'];
Echo $ _ POST ['password'];
Echo $ _ POST ['mailbox'];
$ Mysql_server_name = "localhost ";
$ Mysql_username = "root ";
$ Mysql_password = "11234 ";
$ Mysql_database = "user_information ";
$ SQL = "INSERT INTO 'user _ information '. 'user _ information_library '('User _ name', 'password', 'mailbox') VALUES ("$ _ POST ['username']", "$ _ POST ['password']", "$ _ POST ['mailbox']") ";
Mysql_select_db ($ mysql_database, $ con );
$ Con = mysql_connect ($ mysql_server_name, $ mysql_username, $ mysql_password );
$ Result = mysql_query ($ SQL );
$ Id = mysql_insert_id ();
Mysql_close ($ con );
?>
------ Solution --------------------
$ SQL = "INSERT INTO user_information.user_information_library ('User _ name', 'password', 'mailbox') VALUES ('{$ _ POST ['username']}', '{$ _ POST ['password']}', '{$ _ POST ['mailbox']}') ";
------ Solution --------------------
The join array elements agreed in php are written as follows:
Independent
$ Var ['key'] only checks the array $ var for keys.
$ Var [key] first checks whether the constant key definition exists, and checks whether the array $ var contains a key.
Double quotation marks
"$ Var ['key']" error
"$ Var [key]" only checks the array $ var for keys
"{$ Var ['key']}" only checks whether the array $ var contains a key.
"{$ Var [key]}" first checks whether the constant key definition exists, and checks whether the array $ var contains the key.