473,387 Members | 1,592 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

How to get the last inserted id in a table in mysql ?

Prakash Gnana
How to get the last inserted id in a table in mysql ?

There is a query as
Expand|Select|Wrap|Line Numbers
  1.  $query="select last_insert_id()"; 
.. But i don't know exactly..
Mar 2 '11 #1
2 9223
Rabbit
12,516 Expert Mod 8TB
You could select the Max() of the field.
Mar 2 '11 #2
Rabbit
12,516 Expert Mod 8TB
Here is the MySQL documentation for that function: http://dev.mysql.com/doc/refman/5.0/...last-insert-id
Mar 2 '11 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Agathe | last post by:
Bonjour, Je souhaite insérer dans une table MySQL des données provenant d'un fichier texte grâce à un script PHP. Mon fichier porte l'extension "txt" et les données sont séparées par des ";'. ...
1
by: PT | last post by:
I got a problem. And thats..... First of all, I got these three tables. ------------------- ------------------ ---------------------- tblPerson tblPersonSoftware ...
0
by: rodrigo | last post by:
How to get get the last inserted key (value NOT column) in a specific dataTable dt right after dt.Rows.InsertAt according to code and schema below. The key is a autoincrement column. foreach...
0
by: tomzam | last post by:
I'm trying to get mysql working on Fedora Core 4. Actually trying to start the program mysqld without fatal errors. I posted this message first on the linux misc group - but no luck so far. Maybe...
2
by: imranabdulaziz | last post by:
Dear all, i am using asp.net ,C# (VS 2005) and sql server 2005. i have written sp for inserting the the data which written last inserted idendity no. i would like to which method should i...
13
rajiv07
by: rajiv07 | last post by:
Hi to all, I want to know how to select a last inserted record which is the primary key is not an integer. my table ramstr(Primary)----name--service XTC01-------Rajiv---service ...
20
by: canabatz | last post by:
hi all !! i got my results like that 1 user0 55 2 user1 53 3 user2 49 4 user2 48 5 user3 47 <------- last inserted row 6 user4 46
2
by: viki1967 | last post by:
Hi everyone. My table mysql is: ID Dist Date Hour 15 LT 22/10/2009 08:56:05 14 RM 22/10/2009 08:55:20 13 RM 22/10/2009 08:55:19 12 RM 22/10/2009 08:51:22
5
by: aniketk | last post by:
How can i get last inserted record. if i don't have any date column in table?
4
semanticnotion
by: semanticnotion | last post by:
Hi guys how can i retrieve the last inserted record from datebase. my primary key is not auto_increment its type is bigint because i want to insert SSN no as a primary key. when i retrive the data...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.