Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-01-2013, 06:54 AM   PM User | #1
c1lonewolf
Regular Coder

 
Join Date: Sep 2002
Posts: 216
Thanks: 0
Thanked 11 Times in 11 Posts
c1lonewolf is an unknown quantity at this point
simple comparison problem

if($Item==0 || $Listing_Page < 2){
//--- Show Items Here ---//
}

Am I missing something? In my script, this simple comparison only returns the left side and totally ignores the right. I thought it was like javascript where if this ||that are true then show the items. It only seems to check left side, but I'm sure I used these before...
__________________
NO Limits!!
c1lonewolf is offline   Reply With Quote
Old 02-01-2013, 07:27 AM   PM User | #2
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,210
Thanks: 59
Thanked 3,996 Times in 3,965 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
Easy way to check: Turn it around.
Code:
if($Listing_Page < 2 || $Item ==0){
Better way to check: DEBUG DEBUG DEBUG!
Code:
echo "DEBUG: Item is $Item and Listing_Page is $Listing_Page<hr/>\n";
if($Item==0 || $Listing_Page < 2){
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
Old Pedant is online now   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:20 AM.


Advertisement
Log in to turn off these ads.