i have been stuck on this error. Appreciate any help on this:
this function is part of a longer code working with ajax. Ajax has no problem reaching into the function, retrieving post data. code returns results with $message and it gets back as to ajax, and data is retrieved as response.message
Error happens the moment it runs into the bind_param.
Tried commenting the codes from bind_param down and ajax returns test messages just fine.
When un-commented bind_param, even with if bind_param fails send message 'fail', else send message 'pass'. nothing gets into the $message.
any ideas to why this happens?
code:
function edit_Loc_Name($connection){//67
$new_loc_name = mysqli_real_escape_string($connection, $_POST['location_editloc_name']);
$projid = mysqli_real_escape_string($connection, $_POST['projid']);
$loc_id = mysqli_real_escape_string($connection, $_POST['edit_loc_id']);
$checklocname = checkLocationLoc($projid,$new_loc_name,$connection);
if ($checklocname === "Duplicate location."){
$message = "Duplicate location.";
}else if($checklocname === "Location okay"){
$stmt = $connection->prepare("UPDATE projectlocation SET locname = ? WHERE id = ?");
if($stmt === false){
$message = "Ajax err:67 1";$stmt->close();
}else{
$stmt->bind_param('si',$new_loc_name,$loc_id);
$rc = $stmt->execute();
if($rc === false){
$message = "Ajax err:67 3";$stmt->close();
}else{
$message = "Location updated.";$stmt->close();
}
}
}else{
$message = "Ajax err:67 5";
}
$connection->close();
return $message;
}