mysql_insert_id()
| From: | Fam de Boer | Date: | Fri, 01 Sep 2000 12:29:48 +0000 |
| Subject: | mysql_insert_id() | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-2556@lists.php.net to get a copy of this message | ||
Hello,
The following snippet:
--------------------
$result = mysql_db_query($db, "insert into klant values (null, '$naam',
'$bedrijfsnaam', '$adres', '$postcode', '$woonplaats',
'$telefoonnummer',
'$email', '$ww')");
if (!$result)
{ echo(mysql_errno(), mysql_error());
return;
}
$klant_id = mysql_insert_id($result);
echo("<<$klant_id>>");
--------------------
It gives an error saying:
Warning: Supplied argument is not a valid MySQL-Link resource in
/opt/guide/www.moc-bedrijfskleding.nl/HTML/beta/order_newcustomer_finalize.p
hp3 on line 70
line 70 is the line:
$klant_id = mysql_insert_id($result);
It worked fine with netscape & php3 on my linux programming server.
When I upload it to the it gives this error. I don't understand what goes
wrong cause there is a $result and klant has an auto incrementing field:
mysql> show fields from klant;
+----------------+---------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------------+---------+------+-----+---------+----------------+
| klant_id | int(11) | | PRI | 0 | auto_increment |
| naam | text | YES | | NULL | |
| bedrijfsnaam | text | YES | | NULL | |
| adres | text | YES | | NULL | |
| postcode | text | YES | | NULL | |
| woonplaats | text | YES | | NULL | |
| telefoonnummer | text | YES | | NULL | |
| email | text | YES | | NULL | |
| ww | text | YES | | NULL | |
+----------------+---------+------+-----+---------+----------------+
What goes wrong ?
Kind regards,
Joachim