0
I have a simple mysql query
SELECT usr_contact FROM $usr_
I use PDO to connect this table has lines that have empty fields thus
-----------------------
| id |usr_contact|
-----------------------
| 1234 | null |
-----------------------
| null | 147852 |
in consultation he creates
contact
---
X
---
147852
how do I not display empty fields in the result?
SELECT * FROM tabela WHERE campo IS NOT NULL
the null id O.o?– rray
@rray "
AutoIncrementProgramming
"?– Guilherme Lautert
@rray does not serve, if I put it SELECT * FROM table WHERE id IS NOT NULL it only brings the null information, if I put SELECT * FROM table WHERE usr_contact IS NOT NULL it brings everything even the nulls
– flourigh
yes, id null because I am creating a different database that does not need the ids because they will all be the same id
– flourigh
A
OR
would not solve or has more column to check?– rray
in fact, will have many lines with empty values, phone book example, has name displays, has no name does not display, this I wish to do, it does not display the lines I do not ask, ie only display the lines with name but not with empty name
– flourigh
When I did the field, I didn’t set it as a NULL standard
– flourigh
Have you tried using left Join? See if this helps you: http://answall.com/questions/116937/left-join-repetir-tabelas/116950#116950
– Diego
then @Diego the error doi in the little piece, forgot to put null in the table, is now working the is not null, but thanks.
– flourigh