Newbie PHP/Mysql question
Posted: Fri Jan 10, 2003 11:23 am
I'm trying to use the following script to update a test database and it errors out. I can't seem to figure it out.
<?
$db = mysql_connect("localhost","root");
mysql_select_db (recipes);
$result = mysql_query ("INSERT INTO (name,ingredients,directions,yield,category)
VALUES ('$name' , '$ingredients' , '$directions' , '$yield' , '$category' ) ");
if(!$result)
{
echo "<b>Something not added:</b> <br>", mysql_error();
exit;
}
if($result)
{
mysql_close($db);
print "Something added sucessfully!";
}
?>
Here's the error...
Something not added:
You have an error in your SQL syntax near '(name,ingredients,directions,yield,category) VALUES ('' , '' ,' at line 1
Thank you
<?
$db = mysql_connect("localhost","root");
mysql_select_db (recipes);
$result = mysql_query ("INSERT INTO (name,ingredients,directions,yield,category)
VALUES ('$name' , '$ingredients' , '$directions' , '$yield' , '$category' ) ");
if(!$result)
{
echo "<b>Something not added:</b> <br>", mysql_error();
exit;
}
if($result)
{
mysql_close($db);
print "Something added sucessfully!";
}
?>
Here's the error...
Something not added:
You have an error in your SQL syntax near '(name,ingredients,directions,yield,category) VALUES ('' , '' ,' at line 1
Thank you