vlakas1981
Programmer
Hi everyone,
I have encountered a problem in my only use of a DELETE statement. Here is the code:
$deleteSQL="DELETE FROM temp_professors WHERE id='$id'";
mysql_select_db($database_sadaes, $sadaes);
$Result2 = mysql_query($deleteSQL, $sadaes) or die(mysql_error());
note that in the same page i have other sql queries running fine, however i think it might have something to do with the previous part of the code which is:
mysql_select_db($database_sadaes, $sadaes);
$query_temp_professor = "SELECT id, name, surname, email, FROM temp_professors WHERE id = $id";
$temp_professor = mysql_query($query_temp_professor, $sadaes) or die(mysql_error());
$row_temp_professor = mysql_fetch_assoc($temp_professor);
$totalRows_temp_professor = mysql_num_rows($temp_professor);
$temp_name=$row_temp_professor['name'] . " " . $row_temp_professor['surname'];
$temp_email=$row_temp_professor['email'];
this is the same table that is being accessed and i think it might have a lock on it.
The error i get from the server is:
You have an error in your SQL syntax near 'FROM temp_professors WHERE id = 1' at line 1
Note also that the query runs fine in mysql.
I have encountered a problem in my only use of a DELETE statement. Here is the code:
$deleteSQL="DELETE FROM temp_professors WHERE id='$id'";
mysql_select_db($database_sadaes, $sadaes);
$Result2 = mysql_query($deleteSQL, $sadaes) or die(mysql_error());
note that in the same page i have other sql queries running fine, however i think it might have something to do with the previous part of the code which is:
mysql_select_db($database_sadaes, $sadaes);
$query_temp_professor = "SELECT id, name, surname, email, FROM temp_professors WHERE id = $id";
$temp_professor = mysql_query($query_temp_professor, $sadaes) or die(mysql_error());
$row_temp_professor = mysql_fetch_assoc($temp_professor);
$totalRows_temp_professor = mysql_num_rows($temp_professor);
$temp_name=$row_temp_professor['name'] . " " . $row_temp_professor['surname'];
$temp_email=$row_temp_professor['email'];
this is the same table that is being accessed and i think it might have a lock on it.
The error i get from the server is:
You have an error in your SQL syntax near 'FROM temp_professors WHERE id = 1' at line 1
Note also that the query runs fine in mysql.