PHP/SQL error[RESOLVED]

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
nawhaley
Forum Commoner
Posts: 85
Joined: Wed May 18, 2005 11:43 am

PHP/SQL error[RESOLVED]

Post by nawhaley »

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?
Last edited by nawhaley on Fri Jan 06, 2006 9:29 am, edited 1 time in total.
nawhaley
Forum Commoner
Posts: 85
Joined: Wed May 18, 2005 11:43 am

Post by nawhaley »

*sigh*..nevermind not enough caffine for Nick this morning apparently it should of dawned on me to use a UPDATE statement
Post Reply