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'); } Quote Link to comment 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 =, ==, ===. Quote Link to comment 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'] Quote Link to comment 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.