I wrote this prepared statment to send data from php to my localhost
$stmt = $conn->prepare("INSERT INTO info VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
if ( false===$stmt ) {echo '<script type="text/javascript">alert("false prepeared statment '.htmlspecialchars($conn->error).'");</script>';}
try{
$rc = $stmt->bind_param("ssssssssssssssssssss", 'f', '$name1', '$name2', '$name3', '$lastname', '$mother', '$bornplace',
'$phone', '$empTitle', '$school', '$lastDegree', '$lastSpeciality', '$lastUniversity', '$lastCollege',
'$subject', '$nextSpeciality', '$nextSubSpeciality', '$nextDepartment', '$nextCollege', '$nextUniversity');
}catch(Exception $er){
echo('err: '.$er->getMessage());
}
$rc = $stmt->execute();
if ( false===$rc ) {echo '<script type="text/javascript">alert("false excute '.htmlspecialchars($stmt->error).'");</script>';}
$stmt->close();
$conn->close();
When I run the program, the execution "freeze" when it reach the bind_param line, with no error message or warning. When I comment the bind_param line, the program execution dosen't "freeze" and contincue to the next lines, and gives me the error message "No data supplied for parameters in prepared statement". Notice I made the variable names (in the bind_param) as a string to make sure the problem is not in the value of the variables. And the try catch statement didn't work either. Moreover, when I put some error in the (prepare) line, it shows me the error. But when I put error in (bind_param) line, it just keep freezing! Notice the localhost showing all the errors in all lines normally. But when it comes to this bind_param it doesn't work as expected. I tried a different table with 3 variables, and there were no problem!