When connecting to the database, when executing the query statement, it appears that $result is a bool value. What exactly is wrong?
You bad bad
You bad bad 2018-03-05 11:42:44
0
3
1604

微信图片_20180305114204.png

You bad bad
You bad bad

reply all(3)
陈刚

You need to use the fetchAll() function to obtain the query results. You have only executed the query and have not obtained the query results!

辉

mysql_query() only returns a resource for SELECT, SHOW, DESCRIBE, EXPLAIN and other statements. If there is an error in the query, it returns FALSE.

The return value should be a resource object, and you can use foreach to read the content. If the return value is false, it means that your sql statement is wrong. Of course, this prompt will appear in the connect sucess after connecting to the database in your code. If this step does not appear, it means that your database connection has not been successful. It may be that the user name and password of the database are incorrect, or the database service is not turned on. Find it yourself.

  • reply I also think there is something wrong with the query quotation, but there is nothing wrong with just two very straightforward sentences. cake is the table name
    You bad bad author 2018-03-05 22:39:33
大辉狼

8FZ2H$H%}O_O9O@T1XWLOTY.png

If the bool value you are talking about is

False

, that is normal.

  • reply Then why does the foreach loop and print report an error?
    You bad bad author 2018-03-05 17:26:55
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template