The actual typo in your code is a trailing comma in your sql statement.

 > '".$img_group."', '".$display."', )";

Strip out the comma after your last single quote.

It's very useful to have CLI access to mysql. Then you could just say,
print "QUERY: $query <BR>\n";
and instead of executing it, paste it into the mysql CLI and see what it has
to say. You may also want to keep an eye on your web server logs, or
raise php errors so they are printed in the web server output, but in this 
case, you'd probably see no error.

--Matt


Robert McPeak wrote:

> 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! ";
> 
> 
> 
> ?>
> 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to