A
A
AlexStolman2015-07-25 03:33:54
PHP
AlexStolman, 2015-07-25 03:33:54

Why is Sql query with WHERE not working as expected?

Why is PDO sql query not working as expected?
Need to get all records from a table with an empty field text
$db->query("SELECT * FROM `textes` WHERE `text`=FALSE ");
#doesn't return anything
$db->query("SELECT * FROM `textes` ");
#displays all records from the table
Maybe the syntax is wrong?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
A
Andrew, 2015-07-25
@AlexStolman

SELECT * FROM `textes` WHERE `text`= 0

A
Andrey Andreev, 2015-07-25
@b0nn1e

$db->query("SELECT * FROM `textes` WHERE `text` IS NULL");

L
lnked, 2015-07-25
@lnked

$db->query("SELECT * FROM `textes` WHERE `text`='' ");

A
Artur Polozov, 2015-07-29
@Noxy

I'll put in my 5 cents:
those that are null and those that are just empty.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question