如果 命令不同步; 您现在无法在客户端代码中运行此命令,您以错误的顺序调用了客户端函数。
例如,如果您使用的是mysql_use_result()并尝试执行新查询,然后再调用mysql_free_result(),则可能发生这种情况。如果您尝试执行两个返回数据的查询,而没有在两者之间调用mysql_use_result()或mysql_store_result(),也会发生这种情况。
从这里:http :
//dev.mysql.com/doc/refman/5.0/en/commands-out-of-
sync.html
更新资料
如果将a用作查询变量,然后将该变量直接粘贴到类似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'], 'Activate your account', "Hello " . $register_data['mem_first_name'] . ",nnThank you for creating an account with H Fencing. Please use the link below to activate your account so we can confirm you identity:nnhttp://blah.blah.co.uk/activate.php?mem_email=" . $register_data['mem_email'] . "&email_pre=" . $register_data['email_pre'] . "nn - David & Jay "); mysqli_free_result($result); return ("Success"); } else { echo $query; die(mysqli_error($myNewConnection)); } }?>


