Registration verification has failed

Source: Internet
Author: User
 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.
  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.