Jump to content


Photo

Keeping track of data


  • Please log in to reply
3 replies to this topic

#1 oldschool

oldschool
  • Members
  • PipPip
  • Member
  • 15 posts

Posted 03 September 2006 - 10:24 AM


Howdy!

I'm trying to find out what the most sensible way is of keeping track of something I've just entered into a database is. For example...

Page 1 - Enter details, hit submit. Data entered in to the database.
Page 2 - Requires some of the data I've just entered to be displayed. I would prefer it if I could grab the record number that has just been created by the database, not the data that has been posted.

Any pointers would be gratefully received. I'm thinking that I need to use a session, but just need some help to get out of the starting block.

thanks
Dan

#2 Barand

Barand
  • Moderators
  • Sen . ( ile || sei )
  • 18,025 posts

Posted 03 September 2006 - 11:15 AM

After inserting the new record, call

$newid = mysql_insert_id();
If you are still using mysql_ functions, STOP! Use mysqli_ or PDO. The longer you leave it the more you will have to rewrite.

Donations gratefully received






moon.png

|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts

#3 oldschool

oldschool
  • Members
  • PipPip
  • Member
  • 15 posts

Posted 03 September 2006 - 11:33 AM


Thank you Barand!  :)

#4 Barand

Barand
  • Moderators
  • Sen . ( ile || sei )
  • 18,025 posts

Posted 03 September 2006 - 11:35 AM

Are you OK with session handling bit?
If you are still using mysql_ functions, STOP! Use mysqli_ or PDO. The longer you leave it the more you will have to rewrite.

Donations gratefully received






moon.png

|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users