On Fri, March 23, 2007 9:45 am, Dan Shirah wrote:
> Okay, I feel like the correct answer to this is about 2mm back in my
> grey
> matter.
>
> 1. I have a query that pulls the last row number when a newly inserted
> record is added:
>
> $maximum="SELECT MAX(payment_id) FROM payment_request";
> $max_result=mssql_query($maximum);
> while($max=mssql_fetch_row($max_result)){
> }
> $max_id = $max[0];
DO NOT DO THIS!!!
As soon as *TWO* people hit your site at the same time, this will blow
up in your face.
Use this:
http://php.net/mysql_insert_id
> 2. I have multiple selections for the user to pick, but regardless of
> what
> they choose I want the $max_id variable to be passed to the next page.
>
> 3. Would I go about this by assigning $max_id to a hidden field like
> below?
>
> <input type="hidden" value="<?php echo "$max_id"; ?>" size="5"
> maxlength="10" name="max_id" />
Yes.
Though the size and maxlength are kinda silly on a "hidden" input...
> 4. And then to retrieve this value on my next page just get it out of
> $_POST['max_id'] ??
>
> Does that all sound correct?
Try it and see.
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php