Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8184149
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T01:24:08+00:00 2026-06-07T01:24:08+00:00

Working in phpMyAdmin for now: order table strucure: OrderID int(11) auto_increment CustomerID varchar(50) BillAddr

  • 0

Working in phpMyAdmin for now:

order table strucure:

OrderID     int(11)  auto_increment
CustomerID  varchar(50)
BillAddr    varchar(200)
ShipAddr    varchar(200)
Date            date
Total           double

The table currently has 4 rows of data, with different OrderIDs.

SQL:

SELECT LAST_INSERT_ID() FROM `order`

Result:

LAST_INSERT_ID()
0
0
0
0

I was expecting the fourth rows OrderID – just one number but got a 0 for each row in phpMyAdmin.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T01:24:10+00:00Added an answer on June 7, 2026 at 1:24 am

    LAST_INSERT_ID() returns the id of the last inserted row and is not bound to any table. So if you create a new row:

    INSERT INTO table VALUES('a', 'b', 'c');
    

    It will return the last id (whatever value the new primary key has).

    SELECT LAST_INSERT_ID();
    => 123 
    

    For details, please take a look at the manual:

    LAST_INSERT_ID() (with no argument) returns a BIGINT (64-bit) value representing the first automatically generated value that was set for an AUTO_INCREMENT column by the most recently executed INSERT statement to affect such a column. For example, after inserting a row that generates an AUTO_INCREMENT value, you can get the value like this:

    If you just want to get last ID in a table, you can do it like this:

    SELECT id FROM table ORDER BY id DESC LIMIT 1;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using PHPMyAdmin right now and I am creating a new table with
I have phpmyadmin running on a remote VPS. It has been working fine for
I'm working on an application that stores conferences with their start and end date.
I've installed MAMP on my MacBook PRO Leopard OS. Phpmyadmin is working fine but
I am working few days with my project and I stuck on phpmyadmin sql.
I'm working on the following project: http://lpmj.net/20.php I've made several entries into phpMyadmin and
In a MySQL table the id column is set to auto_increment and the next
I'm using phpmyadmin and working on someone site whose information is pulled from a
I have setup an Ubuntu LAMP server, and I have had phpmyadmin working fine
Originally, my question was related to the fact that PhpMyAdmin's SQL section wasn't working

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.