Query ($sql); if ($result && $row = $result->fetch_assoc ()) {if ($name = = $row ["name"]) {echo '); exit; }elseif ($mail = = $row ["Mail"] {echo ' "; 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->query ($sql); if ($result && $db->affected_rows>0) {echo ' "; Exit }else{echo ' "; exit; }}} $result->free_result; $db->close; }else{echo ' "; exit;}} else{echo ' "; exit;} $result->free_result; $db->close;? >
The user already exists, this has been failed to verify, each registration of the same user name is successful, should be how to change?
Reply to discussion (solution)
$sql = "SELECT * from user";???
The result of this SQL execution, you know?
He will return all records in the user table, and you only take out the first record $row = $result->fetch_assoc ()
$db->close;
$sql = "INSERT into Userphoto (uid,name,type,url,size,time) value (' {$uid} ', ' Steve ', '. png ', './img/userphoto/steve.png ', ' 6.24kb ', Now ()) ";
Didn't you have close db before?
$sql = "SELECT * from user";???
The result of this SQL execution, you know?
He will return all records in the user table, and you only take out the first record $row = $result->fetch_assoc ()
3q, I understand.