Afternoon,
I am on mysql v.3.23 (its not my fault, its what they have here :rolleyes: ) I have a script that runs fine in mssql but won't run here. If someone could take a look and tell me why it isn't looking? Thanks so much.
else if (isset($_POST['submit'])) {
foreach($arrRowData as $key => $arr) {
// get array keys (database field names)
$arrKeys = array_keys($arrDefaultRow);
$arrValues = array();
foreach($arrKeys as $key2 => $value) {
// add submitted values of this row to value
// array using mysql_escape_string to escape
// e.g. single quotes which would break up the
// SQL query otherwise
$arrValues[] = $arr[$value];
}
//Connect to the database
include ("../connect.php");
//query
$strInserts .= "INSERT INTO Res_Life_Dev.InterviewTimeTbl ("
.implode(",",$arrKeys)
.") VALUES ('"
. implode("','",$arrValues)."')";
}
mysql_query($strInserts)or die ("Query failed: " . mysql_error() . " Actual query: " . $strInserts);;
header ("location: index.php");
}
It keeps dying and giving me this error:
Query failed: You have an error in your SQL syntax near 'INSERT INTO Res_Life_Dev.InterviewTimeTbl (Application_Period,Location,Interview' at line 1 Actual query: INSERT INTO Res_Life_Dev.InterviewTimeTbl (Application_Period,Location,Interview_Date,Start_Time,End_Time,Interview_Type,Max_Interviewees) VALUES ('107701','Baker 102','2006-11-30','12:43','12:43','I','1')INSERT INTO Res_Life_Dev.InterviewTimeTbl (Application_Period,Location,Interview_Date,Start_Time,End_Time,Interview_Type,Max_Interviewees) VALUES ('107701','Baker 102','2006-11-30','12:43','12:43','I','1')INSERT INTO Res_Life_Dev.InterviewTimeTbl (Application_Period,Location,Interview_Date,Start_Time,End_Time,Interview_Type,Max_Interviewees) VALUES ('107701','Baker 102','2006-11-30','12:43','12:43','I','1')
It looks like it isn't looping through the variables. When I run it in QA and throw a GO statement in between the selects it works fine.
Any thoughts would be great.
Laura