Jump to content

Archived

This topic is now archived and is closed to further replies.

NorthWind

IF in CASE problem

Recommended Posts

Hello guys
I 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

Share this post


Link to post
Share on other sites
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)
or
if ($num_itemscm<1)


David.

Share this post


Link to post
Share on other sites
[!--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)
or
if ($num_itemscm<1)
David.
[/quote]


Thanks you David, works like magic. I'm from australia as well :)

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.