TheSky Posted May 15, 2011 Share Posted May 15, 2011 i have made query and i want replace with no data N/A i have tryed with swich but no luck if (($row['name']) = empty) { echo('n/a'); } Link to comment https://forums.phpfreaks.com/topic/236480-if-row-empty/ Share on other sites More sharing options...
Zurev Posted May 15, 2011 Share Posted May 15, 2011 if (empty($row['name'])) { echo 'n/a'; } Reason being, empty is a function. If you wanted to compare it you could do is == "". Take a look at http://php.net/manual/en/language.operators.comparison.php Don't get tripped up on =, ==, ===. Link to comment https://forums.phpfreaks.com/topic/236480-if-row-empty/#findComment-1215749 Share on other sites More sharing options...
TheSky Posted May 15, 2011 Author Share Posted May 15, 2011 hmm but if i have more then one $row['name'] Link to comment https://forums.phpfreaks.com/topic/236480-if-row-empty/#findComment-1215758 Share on other sites More sharing options...
Zurev Posted May 15, 2011 Share Posted May 15, 2011 Do the same thing, and put it in a loop. To be honest, these are extremely basic questions, I think you should take a good look at: http://www.php.net/manual/en/language.control-structures.php before going further. Link to comment https://forums.phpfreaks.com/topic/236480-if-row-empty/#findComment-1215765 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.