IF Record Column is Empty

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
AliasBDI
Forum Contributor
Posts: 286
Joined: Fri Nov 15, 2002 10:35 am
Location: Spring, TX, USA

IF Record Column is Empty

Post by AliasBDI »

I am trying a basic IF clause for a specific column. I want it to not show if the column in the record is empty. I tried this but it does not work. Any ideas?

Code: Select all

<?php
if ($row_detailsDoctrine['notes']=="NOT NULL"){ ?>
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

its actually if $var != NULL

but instead you should just do if (!empty($var))
User avatar
Joe
Forum Regular
Posts: 939
Joined: Sun Feb 29, 2004 1:26 pm
Location: UK - Glasgow

Post by Joe »

Code: Select all

<?php
if (!empty($row_detailsDoctrine['notes'])){ ?>
AliasBDI
Forum Contributor
Posts: 286
Joined: Fri Nov 15, 2002 10:35 am
Location: Spring, TX, USA

Post by AliasBDI »

Joe, that nailed it. Thanks a bunch!
Post Reply