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.
replyI 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 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.
If the bool value you are talking about is
, that is normal.