adamschroeder — 2011-03-23T09:55:19-04:00 — #1
I have this query that's selecting data from my database:
$sql_blabs = mysql_query("SELECT username,firstname,blab,date,image FROM testimonials WHERE ....... ORDER BY date DESC LIMIT 5");
But I would like it to select the data where blab has info in it. I mean, the query should be selecting those blabs that have data and not the empty ones. How do I do that?
What do I write after WHERE....
ma201dq — 2011-03-23T10:01:11-04:00 — #2
you can either control the output in your php or in mysql do somthing like:
balb IS NOT NULL
anthonysterling — 2011-03-23T10:01:58-04:00 — #3
adamschroeder — 2011-03-23T10:59:11-04:00 — #4
Ok I listened to both of you and solved it.
I wrote this:
mysql_query("SELECT * FROM testimonials WHERE blab IS NOT NULL ORDER BY date DESC LIMIT 5");
and I changed blab in sql database to be NULL by defaul.