I already run the query without the value of the primary-key field:
>>
  $q_orders_id2 = "INSERT INTO orders(orders_datum, orders_sessid)";
  $q_orders_id2.= " VALUES ('$date', '$sid')";
  $r_orders_id2 = mysql_query($q_orders_id2, $sqllink_id);
  $orders_id = mysql_insert_id($sqllink_id);
<<

The primary-key field is: "orders_id" (not in above query).
Only "orders_datum" and "orders_sessid" are sent with the query.

When I call mysql_insert_id with tha vars: "$q_orders_id" or
"$r_orders_id" I get an warning (Warning: Supplied argument
is not a valid MySQL-Link resource in /home/httpd/blabla/file.php
on line 91) but not the wanted id.

In the manual it says that mysql_insert_id() is used with the
linkidentifier ($sqllink_id ? ) but not how to define the identifier
in mysql_query()...

>>How do I define a linkidentifier for a specific call to
  mysql_query() and then use mysql_insert_id() with that
  linkidentifier of the query?

regards
Bart


-----Oorspronkelijk bericht-----
Van: Alberto. Sartori [mailto:[EMAIL PROTECTED]]
Verzonden: maandag 28 januari 2002 13:11
Aan: [EMAIL PROTECTED]
Onderwerp: R: [PHP-DB] mysql_insert_id - link_identifier


Run the query without the value of the primary-key field.

-----Messaggio originale-----
Da: B. Verbeek [mailto:[EMAIL PROTECTED]]
Inviato: luned́ 28 gennaio 2002 13.08
A: Alberto. Sartori
Oggetto: RE: [PHP-DB] mysql_insert_id - link_identifier


? How do you mean ?
regards

-----Oorspronkelijk bericht-----
Van: Alberto. Sartori [mailto:[EMAIL PROTECTED]]
Verzonden: maandag 28 januari 2002 12:35
Aan: [EMAIL PROTECTED]
Onderwerp: R: [PHP-DB] mysql_insert_id - link_identifier


You can omit the primary key if the filed have auto-increment type

-----Messaggio originale-----
Da: B. Verbeek [mailto:[EMAIL PROTECTED]]
Inviato: luned́ 28 gennaio 2002 12.29
A: Php-Db-Help (E-mail)
Oggetto: [PHP-DB] mysql_insert_id - link_identifier


Hello,

How do I use the linkidentifier to get me the last_inserted_id
(mysql_insert_id) from a auto_increment-colomn?

Do I use:
>>
  $q_orders_id2 = "INSERT INTO orders(orders_datum, orders_sessid)";
  $q_orders_id2.= " VALUES ('$date', '$sid')";
  $r_orders_id2 = mysql_query($q_orders_id2, $sqllink_id);
  $orders_id = mysql_insert_id($sqllink_id);
<<

"$sqllink_id" must be the inserted value for the auto-increment-colomn named
"orders_id" and is placed in var "$orders_id"


Can anyone tell me if this is correct and what can be done to optimize?


regards
Bart



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]





-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to