请问这个问题是怎么回事?我的代码如下:
<?
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);
?>
------解决方案--------------------
$sql ="INSERT INTO user_information.user_information_library(`user_name`,`password`,`mailbox`) VALUES('{$_POST['username']}','{$_POST['password']}','{$_POST['mailbox']}')";
------解决方案--------------------
php 约定的关联数组元素的写法:
独立的
$var['key'] 只检查数组 $var 中是否有键 key
$var[key] 先检查是否有常量 key 定义,在检查数组 $var 中是否有键 key
双引号中
"$var['key']" 出错
"$var[key]" 只检查数组 $var 中是否有键 key
"{$var['key']}" 只检查数组 $var 中是否有键 key
"{$var[key]}" 先检查是否有常量 key 定义,在检查数组 $var 中是否有键 key