Hello.
I am new at this (as my code will show) and I am having problems with a SQL UPDATE command.
Here is the code:
$table = "teachers";
$newID_post = $POST["newID"];
$newlock_post = $POST["newlock"];
mysql_connect($DBhost,$DBuser,$DBpass) or die("Unable to connect to database to add");
@mysql_select_db($DBName) or die("Unable to select database $DBName to add");
$sqlquery1 = "UPDATE $table SET Lock ='".$newlock_post."' WHERE ID=".$newID_post;
<<<
The error message ont the web page is:
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'Lock ='Y' WHERE ID=1' at line 1
<<<
The peculiar thing is the code below works on another page:
$table = "tbl_dist";
mysql_connect($DBhost,$DBuser,$DBpass) or die("Unable to connect to database to add");
@mysql_select_db($DBName) or die("Unable to select database $DBName to add");
if ($newgrade_post >= 6 && $newgrade_post <= 8)
{
$table = "mvotes";
}
else
{
$table = "hvotes";
}
$sqlquery1 = "UPDATE $table SET Grade ='".$newgrade_post."', Citizenship='".$newcitizenship_post."', Leadership='".$newleadership_post."', Most_Improved='".$newmost_improved_post."' WHERE ID=".$newID_post;
<<<
Database Type= InnoDB
Database Field information
Lock=CHAR, Size=1, Not Null, Default Value=N
ID=TinyInt, Size-4, Not Null, Auto-Increment,
Since I did not get a database connection error, I know am connecting. Since ther error messages display my variables, I know that my values are transferring from one page to another (yes, I know I can do it all in one page but I am new to this.), and unless my glasses need cleaning, the formats are essentially identical.
So...
I come you wise and experienced people with my woe! 🙂
In advance of your comments, I thank you.
Gratefully,
Jules III