![]() |
![]() |
![]() |
||||
Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact us. |
![]() ![]() |
|
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. |
|
Thread Tools |
![]() |
#1 |
Confirmed User
Industry Role:
Join Date: Nov 2003
Location: Toronto
Posts: 4,001
|
quick php question
I suck with php. Don't post unless i spent over an hour trying to figure out a simple equation.
What is the correct way to say this? If the item is part1, part2, or the ebay fees are under 25, sig is 0, otherwise sig is 1. I tried putting the brackets in different spots with no luck, sig keeps being declared as 0 even though the item is for part1 and the ebay fees are over 25. Below is the most recent code I tried. Code:
<?php if ($item->SKU != 'part1' || $item->SKU != 'part2' || $recipient->ebay_fees < '25'){ $sig='0';} else { $sig='1';} print $sig ?> |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#2 |
Confirmed User
Industry Role:
Join Date: Jul 2012
Posts: 3,073
|
!= means not equal right? and == means equal?
I'm not good at PHP either.
__________________
Live Sex Shows |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#3 | |
Confirmed User
Industry Role:
Join Date: May 2012
Posts: 124
|
Quote:
php isnt stricly typed but just for purposes of practice if (($item->SKU != 'part1' || $item->SKU != 'part2') || $recipient->ebay_fees < '25'){ $sig='0';} else { $sig='1';} should work |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#4 |
Confirmed User
Industry Role:
Join Date: May 2012
Posts: 124
|
also actually the other poster is right != is not equal and == is equals so not sure if it was a typo in your explanation or just wrong coding
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#5 | |
Confirmed User
Industry Role:
Join Date: Nov 2003
Location: Toronto
Posts: 4,001
|
Quote:
if I echo $recipient->ebay_fees it shows a value of 27, thats the way I am pulling it. |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#6 |
Confirmed User
Industry Role:
Join Date: Nov 2003
Location: Toronto
Posts: 4,001
|
I intentionally put does not equal !=
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#7 |
Confirmed User
Industry Role:
Join Date: Nov 2003
Location: Toronto
Posts: 4,001
|
Basically sig should be 1 if any of those 3 criteria are met which 2 of 3 are.
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#8 |
Confirmed User
Industry Role:
Join Date: Jul 2012
Posts: 3,073
|
Now, I am no PHP expert but maybe it will make more sense, If you say what the criteria is as opposed to what it isn't
If I am hearing your right, it should be completely backwards. if the item is 1 or the item is 2 or the fee < 25 sig 1, is that correct? If so. if (($item->SKU == 'part1' || $item->SKU == 'part2') || $recipient->ebay_fees > '25'){ $sig='1';} else { $sig='0';}
__________________
Live Sex Shows |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#9 |
Just Doing My Own Thing
Industry Role:
Join Date: Jan 2011
Location: London, Spain, New Zealand, GFY - Not Croydon...
Posts: 25,044
|
Have you tried using 'Switch-Case' instead?..
http://php.net/manual/en/control-structures.switch.php Example: PHP Code:
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#10 |
Confirmed User
Industry Role:
Join Date: Jul 2013
Posts: 89
|
PHP Code:
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#11 | |
Confirmed User
Industry Role:
Join Date: Nov 2003
Location: Toronto
Posts: 4,001
|
Quote:
Thanks for all the suggestions, this one worked in declaring sig as 1 but if sig is not 1 then it does not declare sig as anything, it should be declared as 0 if not 1, i think I can do this myself though ![]() I did the not equals because sometimes there are multiple items and this was my way of troubleshooting it |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#12 |
Confirmed User
Industry Role:
Join Date: Nov 2003
Location: Toronto
Posts: 4,001
|
Got it all fixed, thanks again!
|
![]() |
![]() ![]() ![]() ![]() ![]() |