NorthWind Posted May 16, 2006 Share Posted May 16, 2006 Hello guysI have a problem and can't seem to find whats wrong with it. The code is here[code]switch ($serial) { case 'na': $querycms = "SELECT * FROM cmserial"; $resultcms= mssql_query($querycms, $link); $num_itemscm = mssql_num_rows($resultcms); echo $num_itemscm; if ($num_itemscm=<0) { $serial=0;} else { $serial=$num_itemscm++;} break; case '': $serial = '(not entered)'; break; }[/code]it returns me an empty blank white page. I closed some parts and at last found out that the problem is in the if section of it.Any help will be appriciated since I can not find what's wrong with this code since last friday.When you close the IF and else section it works, when i put it in, it doesnt.thanks Link to comment https://forums.phpfreaks.com/topic/9746-if-in-case-problem/ Share on other sites More sharing options...
Crimpage Posted May 16, 2006 Share Posted May 16, 2006 You have...:if ($num_itemscm=<0)the number of rows returned are never going to be less than 0, so just use if ($num_itemscm=0)orif ($num_itemscm<1)David. Link to comment https://forums.phpfreaks.com/topic/9746-if-in-case-problem/#findComment-36133 Share on other sites More sharing options...
NorthWind Posted May 16, 2006 Author Share Posted May 16, 2006 [!--quoteo(post=374176:date=May 16 2006, 09:45 AM:name=Crimpage)--][div class=\'quotetop\']QUOTE(Crimpage @ May 16 2006, 09:45 AM) [snapback]374176[/snapback][/div][div class=\'quotemain\'][!--quotec--]You have...:if ($num_itemscm=<0)the number of rows returned are never going to be less than 0, so just use if ($num_itemscm=0)orif ($num_itemscm<1)David.[/quote]Thanks you David, works like magic. I'm from australia as well :) Link to comment https://forums.phpfreaks.com/topic/9746-if-in-case-problem/#findComment-36135 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.