• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Grab last database entry...

LEGEND ,
Sep 15, 2006 Sep 15, 2006

Copy link to clipboard

Copied

I have seen many ways to do this and I have instituted a 'poor mans' way of
doing it, but doesnt anyone know a complete method to be able to insert an
entry into a database and then turnaround and grab the id key to pass along
to the next page?

I am seeking a way to do it with MySQL and MS SQL (if that make a
difference) but using CF / SQL.

Thanks.


TOPICS
Advanced techniques

Views

217

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 15, 2006 Sep 15, 2006

Copy link to clipboard

Copied

select max(something) with a big enough where clause works on pretty well any db.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 18, 2006 Sep 18, 2006

Copy link to clipboard

Copied

LATEST
What I am refering to (and I may be wrong and you supplied the right answer)
is this senerio.

My user, demo, creates a project using a 2 step form.

Step one:
Fills in information such as project name, due date, client, and project
type and clicks 'continue'.
That information is inserted into the database (project table) and they are
taken to another form to finish the project information.
The second form captures the project_id (key and auto increment) that was
just inserted and when the user completes the second form (upload images),
it update the data in the project table.

Currently I have it where the 2nd page queries the database for the last
entry by that username (in this case: demo) and gets the project_id that
way. However, I don't think it is the most effective way to do it.

Thanks!


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation