new to php/mysql - insert not working
| From: | ROBERT MCPEAK | Date: | Wed, 20 Mar 2002 14:49:36 +0000 |
| Subject: | new to php/mysql - insert not working | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-89343@lists.php.net to get a copy of this message | ||
Can somebody help me with this?
The following code gets me "document contains no data." I have done a
successfull select from mysql db, but not an insertion.
I don't know how to troubleshoot this. Any help is much appreciated.
Thanks!
<?php
$id = addslashes($id);
$visitdate = addslashes($visitdate);
$img_group = addslashes($img_group);
$img_url = addslashes($img_url);
$display = addslashes($display);
@ $db = mysql_connect("www", "mmc", "mmc-WWW");
if (!$db)
{
echo "Error: Could not connect to database. Please try again
later.";
exit;
}
mysql_select_db("mmc");
$query = "insert into visitorgallery values
('".$id."', '".$img_url."',
'".$visitdate."',
'".$img_group."', '".$display."', )";
$result = mysql_query($query);
if ($result)
echo mysql_affected_rows()." Image inserted! ";
?>