Page 1 of 1
show only records that have data in a particular column
Posted: Wed Jul 20, 2011 6:14 pm
by inosent1
Code: Select all
<?PHP
include("dbinfo.inc.php");
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$fetch = mysql_query("SELECT * FROM table LIMIT 0, 10") or
die(mysql_error());
?>
the above pulls the data, the first 10, and then a next link will show 10 at a time until the end of the table, etc
but what i want is to pull records only if a particular field in that row is not empty.
how do i do this?
thanks
Re: show only records that have data in a particular column
Posted: Wed Jul 20, 2011 10:45 pm
by twinedev
Well it depends what you mean by "empty":
for blank string:
SELECT * FROM table WHERE field<>"" LIMIT 0,10
for a null value:
SELECT * FROM table WHERE field IS NOT NULL LIMIT 0,10
Re: show only records that have data in a particular column
Posted: Thu Jul 21, 2011 3:40 am
by fffengcharger
thank you for share.