The reapeating dilema

Sorry if I have many question. This is because I just new to html stuff

including php and mysql. My new problem is about php that connect to
mysql. I have this idea about updating record about document tracking.
But when I run my script for the first time in one session, there is no

problem, but when I add new record it does repeating. I meant when the
time I entry the data the number is 1, the second time I doing it
the number became 3. I checked the database; I got
confused because it has the record between number 1 and number 3. Use 2

table tbltahun and tblsurat This is my script:
$r_year=mysql_query(“Select Number,Year from tblyear where
if (mysql_num_rows($r_year)!=1)
//if there is no number create new
$r_new_digit=mysql_query(“UPDATE tblyear SET Number=’$new_digit’ WHERE


$s_query_save=”insert into tblmail values
if (!$r_new_number)
// some code to tell there is something wrong
echo “$new_number”;

Leave a Reply

Your email address will not be published. Required fields are marked *