0
  mssql_query("INSERT into User_Shoutbox(user,message) VALUES('$user','$message')",$dbhandle );

This code inserts the Variables User and Message into the database. But this code keeps giving me an error...

message: Incorrect syntax near the keyword 'user'. (severity 15) in Shoutbox.php on line 36

So how do I insert the variables into the Database properly?

1
  • Please do tell if need be any cleaer. Commented Dec 25, 2010 at 7:36

2 Answers 2

1

$query="INSERT into User_Shoutbox (user,message) VALUES('$user','$message')"; mssql_query($query,$dbhandle );

Sign up to request clarification or add additional context in comments.

2 Comments

This is result Warning: mssql_query() [function.mssql-query]: message: Incorrect syntax near the keyword 'user'. (severity 15) in
Which the collum does exists?
0

You're probably not still stuck on this, but "user" is a protected keyword in SQLServer.

mssql_query("INSERT into [User_Shoutbox] ( [user], [message] ) 
VALUES( '$user', '$message' )", $dbhandle );

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.