Reference Number...HELP!!!
Posted: Wed Jan 14, 2004 12:15 pm
i have a new pronblem...heheh..
I have a submit form that is managed with PHP. On the form, there has to be a reference number that has to be incremented every time a user submits.And the reference number interacts with mysql..
heres my code:
the output is like REF001/2004..
but when i submit it again,it still show REF001/2004..
it suppose to show REF002/2004 (increment by 1)..
wheres the error??
hmm...help!!!!!!!!!
hmmm..i try to check in my mysql database..
theres a strange thing happens...
the rujAduan table is consist of "ID" and "ref" field...
suppose the "ref" field is increased by 1...(look at the code)
but why must the ID field is increase?
haaaaaa.......HELP!!!!!!!!!!!
I have a submit form that is managed with PHP. On the form, there has to be a reference number that has to be incremented every time a user submits.And the reference number interacts with mysql..
heres my code:
Code: Select all
//---------------------------------------
// DATE FUNCTION
//---------------------------------------
$Tdate = getdate();
$datToday = date("d/m/Y");
$year=$Tdate['year'];
//---------------------------------------
// REFFRENCE NUMBER
//---------------------------------------
$query = "Select * from ".$DBprefix." rujAduan";
$logCursor = mysql_query($query);
if ($logCursor.$EOF) {
$refNum = 1;
} else {
$refNum = $logCursor["ref"] + 1;
}
if ($refNum < 10) {
$refNumber = "00".$refNum;
} else {
if ($refNum < 100) {
$refNumber = "0".$refNum;
} else {
$refNumber = $refNum;
}
}
$referNum = "REF".$refNumber."/".$year;
?>but when i submit it again,it still show REF001/2004..
it suppose to show REF002/2004 (increment by 1)..
wheres the error??
hmm...help!!!!!!!!!
hmmm..i try to check in my mysql database..
theres a strange thing happens...
the rujAduan table is consist of "ID" and "ref" field...
suppose the "ref" field is increased by 1...(look at the code)
but why must the ID field is increase?
haaaaaa.......HELP!!!!!!!!!!!