Re: validation & inserts not working
| From: | Lex Braun | Date: | Wed, 11 Mar 2009 19:33:18 +0000 |
| Subject: | Re: validation & inserts not working | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-289891@lists.php.net to get a copy of this message | ||
PJ,
> <snip>
> > $sql1 = "INSERT INTO book ( title, sub_title, descr,
> > comment, bk_cover, copyright, ISBN, language, sellers )
> > VALUES ('$titleIN', '$sub_titleIN', '$descrIN',
> > '$commentIN',
> > '$bk_coverIN', '$copyrightIN', '$ISBNIN',
> > '$languageIN',
> > '$sellersIN')";
> > $result1 = mysql_query($sql1, $db);
> > $autoid = mysql_insert_id($result1);
>
You're actually sending mysql_insert_id() the wrong parameter. It should be:
$autoid = mysql_insert_id($db); // you send the resource of your MySQL
connection (http://ca3.php.net/manual/en/function.mysql-insert-id.php)
This should be corrected in everywhere you call mysql_insert_id()
-Lex