Query statement has an exception, looking for a long time have not found, which master to help my brother to see

Source: Internet
Author: User
Query statements have errors, looking for a long time have not found, who help me to see!
I set the condition that number=512 only one record in the database that meets the criteria, but each traversal output outputs all the data?
have been unable to find the reason.
PHP Code
  
                  $sql = "SELECT * from ' Test ' where number=512";    $SQLM = mysql_query ($sql);    while ($row = Mysql_fetch_array ($SQLM)) {  ?>          name:    
  
       Gender:    
  
            Date of birth:    
  
       Age    
  
    :         Current place of residence:    
  
           remark:    
  
     
  
   


------Solution--------------------
You can first print the SQL statement first. And then put it in the phpMyAdmin to see if the SQL is wrong ...
------Solution--------------------
Execute your SQL in phpMyAdmin
Post the results
------Solution--------------------
Number is a varchar form.
The SQL statement should be $sql = "SELECT * from ' Test ' where number= ' 512 '";
------Solution--------------------
You must enclose the string in quotation marks, or you can change the field to an int type.
  • 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.