PHP:准备好的语句(新手)遇到此错误
|
我是刚准备好的报表的新手,并试图使工作变得简单。
这是我的数据库表:
`unblocker_users` (
`uno` bigint(20) NOT NULL AUTO_INCREMENT,
`user_email` varchar(210) DEFAULT NULL,
`pw_hash` varchar(30) DEFAULT NULL,
`email_confirmed` tinyint(4) DEFAULT NULL,
`total_requests` bigint(20) DEFAULT NULL,
`today_date` date DEFAULT NULL,
`accessed_today` tinyint(4) DEFAULT NULL,)
这是我插入一些测试数据的功能
function add_new_user($e_mail1)
{
require_once \"db.php\";
// ####### Below line is giving an error ########
$stmt = $mysqli->prepare(\"INSERT INTO unblocker_users VALUES (\"\",?, ?,0,0,?,0)\");
$stmt->bind_param(\'sss\', $e_mail1, $this->genRandomString(1),$this->today_date());
$stmt->execute();
$stmt->close();
$done = $stmt->affected_rows;
return $done;
}
如您在上面看到的,我已标记出给我一个错误的行。
错误是\" Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in...\"
我哪里做错了?
没有找到相关结果
已邀请:
3 个回复
坝胺绣敝
看到您关闭并再次打开值中的字符串,将
更改为
这就是我一眼就能看到的一切。
靛新比比催
是2个字符串:
但是您不想对他们做什么。 将外部引号更改为单引号,它应该可以工作:
辰炔诚薯
在php中,如果要在双引号中使用双引号,则必须转义内部的双引号
或使用单引号作为外部...
...或内引号
据我所知mySQL反正使用单引号