php-db | 2001071
Date: 07/10/01
- Next message: Taylor, Stewart: "RE: [PHP-DB] problem with form"
- Previous message: Jennifer Arcino Demeterio: "[PHP-DB] problem with form"
- Next in thread: Michael Rudel: "RE: [PHP-DB] finding out the result of an INSERT"
- Reply: Michael Rudel: "RE: [PHP-DB] finding out the result of an INSERT"
- Reply: Roger Ramirez: "Re: [PHP-DB] finding out the result of an INSERT"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi,
this might be a stupid question but it's got me stumped today
My setup: php, mysql, apache etc
I'm inserting a record into a table that's got a primary key which is auto
incrementing ..
+---------------+---------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+---------------+---------------+------+-----+---------+----------------+
| message_id | int(11) | | PRI | NULL | auto_increment |
| message_text | mediumtext | YES | | NULL | |
| topic_id | int(11) | YES | | NULL | |
| user_id | int(11) | YES | | NULL | |
| message_title | varchar(50) | YES | | NULL | |
| message_time | timestamp(14) | YES | | NULL | |
| parent_id | int(11) | YES | | NULL | |
| thread_id | int(11) | YES | | NULL | |
+---------------+---------------+------+-----+---------+----------------+
by doing
$sql = "INSERT INTO messagetable(user_id, message_title, message_text,topic_id,
thread_id, parent_id) VALUES
('$userid','$subject','$comment','$topic_id','$thread_id','$parent_id')";
mysql_query($sql);
which works fine BUT is there any way of finding out the message_id of the
record I just inserted ?
with thanks
Christian
Christian Cable
ICT Assistant
Careers Service; Lancaster University
Tel: (01524) 594072 Fax: (01524) 592072
http://www.lancs.ac.uk/staff/cable/
-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-db-unsubscribe <email protected> For additional commands, e-mail: php-db-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: Taylor, Stewart: "RE: [PHP-DB] problem with form"
- Previous message: Jennifer Arcino Demeterio: "[PHP-DB] problem with form"
- Next in thread: Michael Rudel: "RE: [PHP-DB] finding out the result of an INSERT"
- Reply: Michael Rudel: "RE: [PHP-DB] finding out the result of an INSERT"
- Reply: Roger Ramirez: "Re: [PHP-DB] finding out the result of an INSERT"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

