PDA

View Full Version : reference numbers on forms


buzzby
07-01-2004, 07:49 PM
is it possible to display the id number and not just have it as a silent partner in the whole sql schema? also is it possible to set the id at a particular value and increment from there? i ask this because i want to have a reference number on the forms that people fill in. the reference number is not editable. they appear on the form either in the table or in the form. which ever is easiest. is this possible?

i would really appreciate some feedback on this as it is quite urgent

if it isnt possible to have the id number present is it then possible to display a reference number on the form like 'A300' then sequentially ascend like 'A301' 'A302' and so on

ClubCosmic
07-03-2004, 01:24 PM
first, i would create a variable that is incremented each time it is queryed from the database. then display it in the form. when the form is submitted, insert it back into the table where it was retrieved in the first place.

$refnum = $result_from_query[refnum] + 1;
echo '$refnum"; //this will display the reference # with an increment of 1. //


$query = "UPDATE yourtablename SET refnum='$refnum'";
//this will replace the former refnum with the new one. //

I don't claim to be an expert but this is what worked for me. Hope i explained it well.
good luck,