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 7963461
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T05:36:40+00:00 2026-06-04T05:36:40+00:00

After I insert values into a new row, I need the results from that

  • 0

After I insert values into a new row, I need the results from that query.
mysql_query() only returns true or false when doing a INSERT command.
The only solution I can think of for something like this is by creating a temporary number/id in PHP and inserting it into its own column. Then fetching that row it with a second command.
However it may be possible that my random id is not random enough to accidentally select the wrong row when the script is executed multiple times.

Is there a way to execute the INSERT command on a mysql_query() call so that it returns the rows created?

  • 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-04T05:36:41+00:00Added an answer on June 4, 2026 at 5:36 am

    It sounds like you should be using AUTO_INCREMENT and mysql_insert_id(). AUTO_INCREMENT will create a unique ID for each row automatically which you can retrieve using mysql_insert_id();

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using sqlite3, I inserted a new row into table Foo. INSERT INTO Foo VALUES
I need to create trigger in SQL Server 2008 that gone insert all values
Using a VBA script in Excel, I'm trying to insert a new row into
I am trying to create a new row to a database using insert into
I want to INSERT VALUES after user has clicked OK on the confirmation box.
I've got an after insert trigger that works well. However, I want it to
What is the T-SQL syntax for granting a specific user only insert permission after
I've noticed that my code errors out on sqlWrite.ExecuteNonQuery(); after executing 200 Insert queries
I have a simple question. Ive got a trigger to insert the values into
I'm trying to insert a row into a PostgreSQL table with a serial primary

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.