|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
rshandel Smarty Rookie
Joined: 29 Mar 2009 Posts: 16
|
Posted: Wed Sep 01, 2010 9:39 pm Post subject: if statement with blank field |
|
|
I have field in a mysql database and I want to check to see if its blank and having trouble finding the value if its blank.
i used
{if $myfield ne ""} or {if $myfield ne " "} or {if $myfield ne "NULL"} and none them seem to work.
Any suggestions?
Thanks |
|
Back to top |
|
ChrisFah Smarty Pro
Joined: 02 Nov 2009 Posts: 159 Location: Traun, Austria
|
Posted: Thu Sep 02, 2010 1:15 pm Post subject: |
|
|
Hi,
try the other way round:
Code: |
{if ((isset($myfield)) && ($myfiels != ''))} {$myfield}
{else} alternate text for empty field {/if} |
Regards, Chris |
|
Back to top |
|
rshandel Smarty Rookie
Joined: 29 Mar 2009 Posts: 16
|
Posted: Thu Sep 02, 2010 3:40 pm Post subject: |
|
|
Thank, Chris.
Worked like a champ! |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|