> 1. user A insert into table (get id = 1 from auto increment value)
> 2. user B insert into table (get id = 2 from auto increment value)
> 3. user A get value from $id = LAST_INSERT_ID() (id = 2)
> 4. user B get value from $id = LAST_INSERT_ID() (id =2)
[8<]
> How can we make sure that those 3 pro
If I follow you correctly, is the scenario below possible.??
Let's say there are 2 users accessing the app at the same time (user A and
B). Here's the sequnce of operation...
1. user A insert into table (get id = 1 from auto increment value)
2. user B insert into table (get id = 2 from auto increm
At 9:19 PM -0700 9/11/09, aveev wrote:
The reason why I used incremental value from the db is that I need a sequence
number generator that can be used as an argument to my function. If I can
generate sequence number myself, I don't need this incremental value from
db.
What I want is that the sequ
The reason why I used incremental value from the db is that I need a sequence
number generator that can be used as an argument to my function. If I can
generate sequence number myself, I don't need this incremental value from
db.
What I want is that the sequential alphanumeric id that increments i
aveev wrote:
where the id consists of 3 alphanumeric characters and 4 numerical digits in
the beginning (for numerical digit, it can grow like this AAA10001). I try
to use php script to generate id like this, where I use the following
script.
$id = $num;
if($num_dig <= $sta
I don´t know if it´d be the right way, but what about using trigger in this
case?
"aveev" escreveu na mensagem
news:25391939.p...@talk.nabble.com...
>
> I want to create user generated id like this :
> AAA0001
> AAA0002
> ...
> AAA0009
> AAA0010
>
> where the id consists of 3 alphanumeric ch
You can use mysql's autoincrement ,but you must do some php for
special display,follow is my method.
1.create an int or smallint mysql col.
2.set it autoincrement.
3.insert some dates to database.
4.select dates and display with letter prefix.
for example: 12->AAA0012,AAA1234,
you can make an php
I agree that this question could be just "how to create an unique ID with
leading letters like 'AAA'.
At that point I want to mention that a timestamp does garanty a unique
number at almost 100% formated with the given samples in the other posts
will do the job.
"tedd" wrote in message
news:p062
At 3:17 PM -0700 9/10/09, aveev wrote:
I want to create user generated id like this :
AAA0001
AAA0002
...
AAA0009
AAA0010
where the id consists of 3 alphanumeric characters and 4 numerical digits in
the beginning (for numerical digit, it can grow like this AAA10001). I try
to use php script to g
On Sep 11, 2009, at 3:50 AM, Ashley Sheridan
wrote:
On Fri, 2009-09-11 at 00:19 -0400, Phpster wrote:
Note that this approach has risks around race conditions. Anytime you
have a construct for the id you run the risk of having it create
duplicate ids. You will need to handle that.
Bast
aveev wrote:
> function generate_id($num) {
> $start_dig = 4;
> $num_dig = strlen($num);
>
> $id = $num;
> if($num_dig <= $start_dig) {
> $num_zero = $start_dig - $num_dig;
>
> for($i=0;$i< $num_zero; $i++) {
>
On Fri, 2009-09-11 at 00:19 -0400, Phpster wrote:
> Note that this approach has risks around race conditions. Anytime you
> have a construct for the id you run the risk of having it create
> duplicate ids. You will need to handle that.
>
> Bastien
>
> Sent from my iPod
>
> On Sep 10, 2009, a
Note that this approach has risks around race conditions. Anytime you
have a construct for the id you run the risk of having it create
duplicate ids. You will need to handle that.
Bastien
Sent from my iPod
On Sep 10, 2009, at 6:49 PM, Ben Dunlap
wrote:
I assume that I can get increment
> I assume that I can get increment value/sequence from db (I used harcoded
> increment value in the code above (generate_id(1))),
> but I don't know how I can get this incremental value from db.I use mysql
> 5.0.
If you're thinking of retrieving the newest value of an AUTO_INCREMENT
column, imm
14 matches
Mail list logo