An exception occurred in the query statement. I haven't found it for a long time. Which of the following experts can help me?

Source: Internet
Author: User
An error occurred in the query statement. I haven't found it for a long time. who can help me! I set the condition that number = 512 only has one record that meets the condition in the database, but every time I traverse the output, all the data is output? The cause cannot be found all the time. PHPcode $ SQL = & quot; select * from 'test' where has an error in the query statement. it has not been found for a long time. who can help me to see it!
I set the condition that number = 512 only has one record that meets the condition in the database, but every time I traverse the output, all the data is output?
The cause cannot be found all the time.
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 Residence:    
          Note:    
    
  


------ Solution --------------------
You can print the SQL statement first. Then run the command in phpmyadmin to check whether the SQL statements are correct...
------ Solution --------------------
Execute your SQL statement in phpmyadmin
Post result
------ Solution --------------------
Number is in the varchar format.
The SQL statement should be $ SQL = "select * from 'test' where number = '000000 '";
------ Solution --------------------
The string must be enclosed in quotation marks, or you can change this field to the 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.