Currently I'm trying to insert multiple rows into a MySQL database with the following code, however I keep receiving error 500 (Internal Server Error)...I'm I doing something in correctly here? I'm relatively new to PHP. Thanks
for ($i = 0; $i < $numberOfOptions; $i++) {
var $insertOptions; <<<<<<<< Error here. Should not have 'var' pre-fix
if ($numbersOrLetters == 0) {
$optionNumber = $i + 1;
$insertOptions = "INSERT INTO Survey_results (Survey_authKey, Option_name, Option_value)
VALUES ('$userAuthKey','$optionNumber','0')";
}
else {
$currentValue = $letter[$i];
$insertOptions = "INSERT INTO Survey_results (Survey_authKey, Option_name, Option_value)
VALUES ('$userAuthKey','$currentValue','0')";
}
mysql_query($insertOptions);
}
Add this on top of your script to enable error reporting.
ini_set('display_errors','On');
error_reporting(E_ALL);
Then you will know what the problem might be.
as requested:
`var $insertOptions;
out of place OOP or to much javascript on the brain?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.