hi....i have some problem here...i'm making a form for ordering...what i want is when user click on form ordering button, there will be a form with reference number echo from database..in database i set the reference number as primary key and auto increment..somebody can help me to solve this problem??

7 Years
Discussion Span
Last Post by diafol

If the auto incremented value must match whats in the database then you will need to insert a row and then get the NEW ID (via ajax probably) using PHP's

echo mysql_insert_id();

You will therefore use UPDATE statements to modify the newly created row


i've try it...but why i get value 0 in reference number in the order form?


Does it have to be a pre-made random id?
or can you do like this:

$randId = rand(1234ab,12345ab);
<input type="hidden" name="randomid" value="<?php echo $randId ?>"> 

and then insert it to mysql?

ezra, could you show your code. We need to see what you're doing in order to see where you've got a problem. Otherwise I'd say look at line 98 and add a ;

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.