php - mysql_query(...) returns boolean value

564

My PHP snippet does not work,var_dump(..) saysbool(false) but the db is filled with 1 record. What am I doing wrong?

$sessionResultSet = mysql_query('select * from sessions');
561

Answer

Solution:

mysql_queryreturn false if you have an error in your SQL query.

echo mysql_error();

should fix that problem.

People are also looking for solutions to the problem: Want to learn how to use php to save data in forms. How come this doesn't work in a html file?

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.