🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: de.comp.lang.php
3 messages
3 total messages Started by Jose Luis Mon, 14 Aug 2000 00:00
Help Index Field of Insert Query
#35
Author: Jose Luis
Date: Mon, 14 Aug 2000 00:00
15 lines
963 bytes
I do an Insert query of a table that like this:

CREATE TABLE name_table (
 id INT(20) NOT NULL AUTO_INCREMENT,
 name MEDIUMTEXT,
 PRIMARY KEY(id));

My query is:
   $query = "INSERT INTO name_table VALUES("'',FREDERIC ROSSELL")";
   $mysql_result = mysql_query($query, $mysql_link);

How i can know what is the value of field id of the new record.

--
Thanks. Jose Luis
Re: Help Index Field of Insert Query
#36
Author: Martin Jansen
Date: Mon, 14 Aug 2000 00:00
13 lines
1132 bytes
* "Jose Luis" <joseluis@REMOVEMEferca.com> wrote:
>My query is:
>   $query = "INSERT INTO name_table VALUES("'',FREDERIC ROSSELL")";
>   $mysql_result = mysql_query($query, $mysql_link);
>
>How i can know what is the value of field id of the new record.

$id = mysql_insert_id();

Martin
-- 
Martin Jansen  � mailto:mail@martin-jansen.de
PGP 0x18176561 � http://www.php.martin-jansen.de/
Re: Help Index Field of Insert Query
#37
Author: brez
Date: Tue, 15 Aug 2000 04:51
1 lines
1145 bytes
$query = "SELECT id FROM name_table WHERE name='FREDERIC ROSSELL' ";
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads