MYSQL + PHP troubles

They have: 850 posts

Joined: Jul 1999

I am having some trouble. This is my first attempt to use a mysql database (or any SQL database for that matter) with PHP. Can someone tell me what is wrong with the following code?

code:

		$message =  addslashes($message);
		$db =  mysql_connect('localhost','root','PASSWORD');
		mysql_select_db("rob", $db);
		mysql_query("INSERT INTO news VALUES ($name, $email, $date, $message)",$db);
		$db = mysql_close();
[/code]

It is *suppose* to add those fields to the 'news' table in the 'rob' database.

Any help would be great,
Thanks.



------------------
http://www.wiredstart.com  : The Technology Start Page 

They have: 122 posts

Joined: Jun 2000

have you tried running that command manually and seeing if it runs ok?

They have: 30 posts

Joined: Apr 2000

mysql_query("INSERT INTO news (Column_Name, Column_Email, Column_Date, Column_Message VALUES ($name, $email, $date, $message)",$db);

------------------
Good looking by Nature... Intelligent by Practice
http://dlo.net/process/profile.php3?user=Westwood

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.