mysql设置参数0和1_mysqli_error()正好需要1个参数,给出0

当我尝试更新数据库中的表时,使用此代码我收到mysqli_error()正好需要1个参数,错误地给出0 .

不知道我哪里出错了,因为我已经查看过这些字段以确认它们的长度 .

// Establish a connection to the database

$con = mysqli_connect("localhost", "root", "password");

// Check if there were any issues connecting to the database

if ( mysqli_connect_errno() != 0)

{

die("An error occurred trying to establish a connection: " .mysqli_connect_error());

}

// Select the database to work with.

$db = mysqli_select_db ($con, "SalesDB");

// Specify the query to run

$sqlString = "UPDATE Customer SET Cust_Fname ='".$_POST["FirstName"] ."', Cust_Lname='" .$_POST["LastName"] ."', Cust_Pasword='" .$_POST["Password"] ."', Cust_email='" .$_POST["Email"] ."', Cust_address='" .$_POST["Address"] ."', Cust_city='" .$_POST["City"] ."', Cust_state='" .$_POST["State"] ."', Cust_zip='" .$_POST["Zip"] ."', Locked_flag='" .$_POST["Lflag"]."', Emp_ID='" .$_POST["EmpID"]."' WHERE Cust_ID = '".$_POST["ID"] ."'";

// Run the query using the connection established earlier and assign the results to a results object.

$rs = mysqli_query ($con, $sqlString);

// Check if update was successful by checking whether the result returned is True

if ( !$rs)

{

$result = "There Was an Error Updating the Record".mysqli_error();

}

else

{

$result = "Record Updated Successfully";

}

// Close the connection

mysqli_close($con);

?>


版权声明:本文为weixin_29463881原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。