am having a student table thata holds records of students. Am having a problem with the on duplicate update key function. With the way my system work, I randomly assign unique numbers 2 student after they save q record..
My query luk likes this
$length=(10000000,999999999); $random=substr(uniqid,0,$length); This query creates an alphanumeric unique key 4 me which works perfectly. .
My save query is dis
$save="insert into student (REG_NUMBER,username,surname) VALUES('$random','username', '$surname') ON DUPLICATE KEY UPDATE username='$username' "; $result=mysql_query($save) or die(mysql_error());
The save part of the query works perfectly, But it doesn't update the existing record, Rather the it creates a new random id without updating The old record. Pls hw do I go about it..need help becos am new 2 php