Best Method For New Record

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
JakeJ
Forum Regular
Posts: 675
Joined: Thu Dec 10, 2009 6:27 pm

Best Method For New Record

Post by JakeJ »

I've got a data entry form and when it's submitted, data gets entered in to the database. No problem there so far.

There are several tables with the primary table being 'client_details'. in which id is an autonumber field.

Quite a number of my variable depend on $id to perform their calculations, other queries, etc.

What is the best method for obtaining a new client id? My thought is that I write an otherwise blank record then do a max(id) query and assign it to $id but that seems a little clunky to me.

Oh, I've coded my form with a static variable for $id for now.

How would you do it?
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: Best Method For New Record

Post by VladSun »

There are 10 types of people in this world, those who understand binary and those who don't
Post Reply