$result=mysqli_query($connection,$query);
if(mysqli_affected_rows($connection)==1)
答案 0 :(得分:0)
你的$ connection参数是一个字符串,而它应该是一个mysqli对象。来自php docs:
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
/* Create table doesn't return a resultset */
if (mysqli_query($link, "CREATE TEMPORARY TABLE myCity LIKE City") === TRUE) {
printf("Table myCity successfully created.\n");
}