Re: PHP doubt
| From: | 1LT John W. Holmes | Date: | Wed, 29 May 2002 12:40:53 +0000 |
| Subject: | Re: PHP doubt | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-99688@lists.php.net to get a copy of this message | ||
> // connected to the database successfully and running this query:
> {
> mysql_query.........etc
> $r=select max(cno)+1 from customer;
> insert into customer values($r,'$name');
> }
> print("Your customer number is: $r");
>
> what do you think? And will this return the correct values if 2 people
> submitted the form at the same time?
Nope...it'll mess up. You want to make that column an auto_incrementing
column (assuming MySQL) that way you are guaranteed unique values.
---John Holmes...