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! Quote Link to comment 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, Quote Link to comment 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 Quote Link to comment 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. 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.