Parseerror: syntaxerror, unexpectedT_VARIABLEonline9 what is the problem? My code is as follows: & lt ;? Echo $ _ POST ['username']; echo $ _ POST ['password']; echo $ _ POST 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.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.