脚本宝典收集整理的这篇文章主要介绍了php – MySqli命令不同步;你现在不能运行这个命令,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
Commands out of sync; you can't run this command Now
function register_user($register_data) { global $myConnection; array_walk($register_data,'array_sanITize'); //Make the array readable and sePErate the fields From data $fields = '`' . implode('`,`',array_keys($register_data)) . '`'; $data = '\'' . implode('\',\'',$register_data) . '\''; //Insert the data and email an activation email to the user MysqLi_query($myConnection,"INSERT INTO `members` ($fields) VALUES ($data)") or die(MysqLi_error($myConnection)); email($register_data['mem_email'],'Activate your account',"Hello " . $register_data['mem_First_name'] . ",\n\nThank you for creating an account with H Fencing. Please use the link below to activate your account so we can confirm you identity:\n\nhttp://blah.blah.co.uk/activate.PHP?mem_email=" . $register_data['mem_email'] . "&email_code=" . $register_data['email_code'] . "\n\n - David & Jay "); }
从这里:
http://dev.mysql.com/doc/refman/5.0/en/commands-out-of-sync.html
更新
如果为查询创建变量并将变量直接粘贴到MysqL Workbench之类,则可以在执行之前检查语法.
<?PHP function myConnection(){ $myConnection = MysqLi_connect('localhost','my_user','my_password','my_db'); return $myConnection; } function register_user($register_data) { array_walk($register_data,'array_sanitize'); //Make the array readable and seperate the fields from data $fields = '`' . implode('`,array_keys($register_data)) . '`'; $data = "'" . implode("','",$register_data) . "'"; //Insert the data and email an activation email to the user $query = "INSERT INTO `members` ($fields) VALUES ($data)"; $myNewConnection = myConnection(); if($result = MysqLi_query($myNewConnection,$query)){ email($register_data['mem_email'],\n\nThank you for creating an account with H Fencing. Please use the link below to activate your account so we can confirm you identity:\n\nhttp://blah.blah.co.uk/activate.PHP?mem_email=" . $register_data['mem_email'] . "&email_code=" . $register_data['email_code'] . "\n\n - David & Jay "); MysqLi_free_result($result); return ("Success"); } else { echo $query; die(MysqLi_error($myNewConnection)); } } ?>
以上是脚本宝典为你收集整理的php – MySqli命令不同步;你现在不能运行这个命令全部内容,希望文章能够帮你解决php – MySqli命令不同步;你现在不能运行这个命令所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。