newtoall Posted April 8, 2007 Share Posted April 8, 2007 If i wanted to check two things in a if statement with out using an elsif how would I do in. for example: if ((!$result) || ($result->num_rows=0)) {do stuff} does not work, what is the best may of doing this in PHP? Hope you can help! Link to comment https://forums.phpfreaks.com/topic/46127-if-question/ Share on other sites More sharing options...
grlayouts Posted April 8, 2007 Share Posted April 8, 2007 if ($something[1] == "RESULT" || $something[2] != "Result2" { mysql_query("UPDATE resulting SET something=3 "); try that, Link to comment https://forums.phpfreaks.com/topic/46127-if-question/#findComment-224157 Share on other sites More sharing options...
PC Nerd Posted April 8, 2007 Share Posted April 8, 2007 if your result if mysql: if(!isset($result) || empty($result) || mysql_num_rows($result)) {do your stuff} the mysql will differ from database to database Link to comment https://forums.phpfreaks.com/topic/46127-if-question/#findComment-224159 Share on other sites More sharing options...
per1os Posted April 8, 2007 Share Posted April 8, 2007 ($result->num_rows=0) // SHOULD BE ($result->num_rows==0) You were just using an assignment operator. Hopefully $result is an object of some type that has num_rows in it, if not than this is a flawed solution and you should use mysql_num_rows() instead. Link to comment https://forums.phpfreaks.com/topic/46127-if-question/#findComment-224203 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.