Welcome to Egypt Forums Mark forums read | Egypt Main Page
Egypt Forums
Arabic Movies



Web Technology Web Design Tools Photoshop,Dreamweaver,Flash,Etc.Tutorials , References , Examples.

Web Technology Thread, SQL problem with INSERT and autoincrement in Programming , WebDesign & Development; I have some php code which inserts a new record into an mysql table. The primary key of the table ...

Short Link: http://forum.egypt.com/enforum/showthread.php?t=25603


Reply
LinkBack Thread Tools Display Modes
SQL problem with INSERT and autoincrement
 
 
Senior Member

Reply With Quote
 
Join Date: Dec 2008
Posts: 18,122
05-02-2009, 04:50 PM
 
I have some php code which inserts a new record into an mysql table. The primary key of the table is auto incremented in mysql. The problem is i need the value of said primary key to use in the php script. This is the insert query Code:...

I have some php code which inserts a new record into an mysql table. The primary key of the table is auto incremented in mysql.

The problem is i need the value of said primary key to use in the php script.

This is the insert query
Code:
$query = "INSERT INTO pages (page_name, qtype, mod_date) VALUES ('".$_GET['qname']."','".$_GET['qtype_id']."','".date(c)."')";
mysql_query($query);
The primary key is the field page_id which is auto incremented by mysql. This is the value i need.

Thanks
 
 
 
Reply

Web Technology Thread, SQL problem with INSERT and autoincrement in Programming , WebDesign & Development; I have some php code which inserts a new record into an mysql table. The primary key of the table ...

Short Link: http://forum.egypt.com/enforum/showthread.php?t=25603


Bookmarks

Tags
autoincrement, insert, problem, sql


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump