Registration Verification failed
Query ($ SQL); if ($ result & $ row = $ result-> fetch_assoc () {if ($ name = $ row ["name"]) {echo 'script '; echo "alert ('User already exists');"; echo "too many locationparameters 'enroll.html '"; echo "script"; exit ;} elseif ($ mail = $ row ["mail"]) {echo 'script '; echo "alert ('This mailbox is used ');"; echo "window.location='enroll.html '"; echo "script"; exit;} else {$ SQL = "insert into user (name, represent, pwd, mail, time) value ('{$ name}', 0, '{$ pwd }',' {$ Mail} ', now () "; $ result = $ db-> query ($ SQL); if ($ result & $ db-> affected_rows> 0) {$ SQL = "select * from user where name = '{$ name}'"; $ result = $ db-> query ($ SQL ); if ($ result & $ row = $ result-> fetch_assoc () {$ uid = $ row ['uid'] ;}}$ result-> free_result; $ db-> close; $ SQL = "insert into userphoto (uid, name, type, url, size, time) value('{}uid}', 'Steve', '.png ','. /img/userphoto/steve.png ', '6. 24kb ', now () "; $ result = $ db-> que Ry ($ SQL); if ($ result & $ db-> affected_rows> 0) {echo 'script '; echo "alert ('registered successfully ');"; echo "window. location = 'index. php '"; echo" script "; exit;} else {echo 'script'; echo" alert ('registration failed ');"; echo "window.location='enroll.html '"; echo "script"; exit ;}}$ result-> free_result; $ db-> close;} else {echo 'script'; echo "alert ('inconsistent passwords, please re-enter ');"; echo "too many locationparameters 'enroll.html'"; echo "script"; Exit ;}} else {echo 'script '; echo "alert ('No agreement agreed, registration failed');"; echo "cannot exceed location+'enroll.html '"; echo "script"; exit;} $ result-> free_result; $ db-> close;?>
The user already exists. this verification fails. every time you register the same user name, it is successful. how can you change it?
Reply to discussion (solution)
$ SQL = "select * from user ";???
Do you know the execution result of this SQL statement?
It will return all records in the user table, and you only retrieve the first record $ row = $ result-> fetch_assoc ()
$ Db-> close;
$ SQL = "insert into userphoto (uid, name, type, url, size, time) value('{iduid}', 'Steve', '.png ','. /img/userphoto/steve.png ', '6. 24kb ', now ())";
Didn't you close the db before?
$ SQL = "select * from user ";???
Do you know the execution result of this SQL statement?
It will return all records in the user table, and you only retrieve the first record $ row = $ result-> fetch_assoc ()
3q, I understand