MYSQL + PHP troubles
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
http://www.thehungersite.com - http://www.therainforestsite.com
http://www.ratemymullet.com - Beauty is only mullet deep.
roBofh posted this at 21:40 — 7th April 2000.
They have: 122 posts
Joined: Jun 2000
have you tried running that command manually and seeing if it runs ok?
Patrick Davis posted this at 22:08 — 7th April 2000.
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
OMG It's Furious George!!!
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.