I'm running MS SQL server and trying to run the following code and it keeps telling me theres an error near the keyword "WHERE".
Code: Select all
$link= odbc_connect("ImmagetechQuiz","Trainee","tra1ning");
$udate =date('m/d/Y h:i:s');
$user = "nawhaley";
print($udate);
$datquery ="INSERT INTO tblStudents (TGPDate) VALUES ('$udate') WHERE Username ='$user'";
$insertdate = odbc_exec($link,$datquery);
I'm really not sure where my error is in this. TGPDate is a datetime format on my SQL server. Is the format wrong, can you not use a WHERE conditional in an insert statement or what?