Wow I think you are on to something!!! I'll give it a
whirl!

Thanks!


--- [EMAIL PROTECTED] wrote:
> On 10 Mar 2004 J J wrote:
> 
> > My problem is how do I recreate this in PHP to
> make
> > sure any newly added records follow this same
> unique
> > ID? 
> 
> I haven't played much with these functions but I
> think for MySQL you'd 
> want something like this, for the state "XX" (excuse
> the wrapped 
> lines):
> 
>       if ($result =
>       mysql_query("select max(id) from table where
> left(id, 2) = 'XX'")) {
>               $row = mysql_fetch_row($result);
>               $newid = strpad($row[0] + 1, 5, "0",
> STR_PAD_LEFT);
>               mysql_query("insert into table set id = 'XX'" .
> $newid);
>               $newrecnum = mysql_insert_id();
>       }
> 
> That is crude and uuntested, needs some error
> checking and most likely 
> table locking, but it's one possibility for a base.
> 
> --
> Tom
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


__________________________________
Do you Yahoo!?
Yahoo! Search - Find what you’re looking for faster
http://search.yahoo.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to