update contacts set confirm_number = confirm_number + 1 order by
contact
desc limit 1
Here is the php query I've been using to send the record in the first
place
$query="INSERT INTO contacts (first_name, last_name, email, phn_number,
address, city, state, zip, dates, comments, confirm_number) VALUES
('$FirstName', '$LastName', '$Email', '$Phone', '$Address', '$City',
'$selected_state', '$Zip', '$newdate', '$Comments' ,
'$confirm_number' )";
$result=@mysql_query ($query);
(obviously in the script, it's all on one line)
Now, what I need to do, is somehow pull make confirm_number get
submitted as a new record, which will happen once they submit the form,
but I want it to be submitted +1. (12345 should now be 12346 but a new
record entirely)
I was trying this code before the submission query:
$confirmnumber="SELECT confirm_number from contacts ORDER BY contact
DESC LIMIT 1";
$confirm_number=$confirmnumber+1;
Now what this is doing for me so far, is just taking the first numeral
of the record, which happens to be 4 (I originally added the
confirm_number via the rand function, but have since taken that out) and
adding 1 to it and that is it.
So the new $confirm_number=5
So it sort of did the job, but not quite..
The question is how can I make a new record (I know the answer to that
part) BUT with a confirm_number of 1 greater than the previous record.
--
Michael S. Dunsavage
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php