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.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 01-01-2005, 09:54 PM   #1
fusionx
Confirmed User
 
Industry Role:
Join Date: Nov 2003
Location: Olongapo City, Philippines
Posts: 4,618
PHP coders - quick question

How do I do this:

IF $_GET['cat'] = 0 OR $_GET['cat'] IS NULL
myCat = 0
else
myCat = $_GET['cat']
END IF

Basically, if there is a request var called "cat" and it is zero, null, or if it doesn't even exist, set a var myCat to zero.
Otherwise, set the var to whatever it currently contains.

Thanks in advance!
fusionx is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-01-2005, 09:59 PM   #2
Aric
Confirmed User
 
Aric's Avatar
 
Industry Role:
Join Date: Sep 2002
Posts: 1,209
if(!empty($_GET['cat']))
$myCat = $_GET['cat'];
else
$myCat = defaultValue;
Aric is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-01-2005, 10:01 PM   #3
fusionx
Confirmed User
 
Industry Role:
Join Date: Nov 2003
Location: Olongapo City, Philippines
Posts: 4,618
Quote:
Originally Posted by Aric
if(!empty($_GET['cat']))
$myCat = $_GET['cat'];
else
$myCat = defaultValue;
Isl ?cat=0 still considered empty?
fusionx is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-01-2005, 10:03 PM   #4
Aric
Confirmed User
 
Aric's Avatar
 
Industry Role:
Join Date: Sep 2002
Posts: 1,209
as far as I know in newer versions of PHP, 0 is empty.. you can also use

!isset($_GET['cat']) if !empty() doesn't work out for ya
Aric is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-01-2005, 10:12 PM   #5
fusionx
Confirmed User
 
Industry Role:
Join Date: Nov 2003
Location: Olongapo City, Philippines
Posts: 4,618
Thanks very much! It works well.
fusionx is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-02-2005, 03:52 AM   #6
richard
Confirmed User
 
Join Date: Feb 2001
Location: UK
Posts: 543
empty($_GET["cat"]) ? ($myCat=0) : ($myCat=$_GET["cat"]);

That's basically what i use.
__________________
richard is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-02-2005, 03:55 AM   #7
hyper
Confirmed User
 
Join Date: Mar 2002
Location: Mass Ass
Posts: 5,294
i use isset
__________________
hyper is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-02-2005, 04:03 AM   #8
opflix
Confirmed User
 
opflix's Avatar
 
Join Date: Jul 2002
Location: HELL
Posts: 1,428
Quote:
Originally Posted by Aric
if(!empty($_GET['cat']))
$myCat = $_GET['cat'];
else
$myCat = defaultValue;

aric, do u have a site or offer programming services? lmk... i have a project if u r available - thanks!

...
__________________
Social Escrow - Buying & Selling Accounts? Contact Me | Social Escrow IG
opflix is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-02-2005, 04:06 AM   #9
grumpy
Too lazy to set a custom title
 
grumpy's Avatar
 
Join Date: Jan 2002
Location: Holland
Posts: 9,870
if($_GET['cat'] < 1){$_GET['cat']=0}
__________________
Don't let greediness blur your vision | You gotta let some shit slide
icq - 441-456-888
grumpy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-02-2005, 05:25 AM   #10
woj
<&(©¿©)&>
 
woj's Avatar
 
Industry Role:
Join Date: Jul 2002
Location: Chicago
Posts: 47,882
if cat is a numeric value, like a category id or something, you can do:
$myCat=intval($_GET['cat']);
__________________
Custom Software Development, email: woj#at#wojfun#.#com to discuss details or skype: wojl2000 or gchat: wojfun or telegram: wojl2000
Affiliate program tools: Hosted Galleries Manager Banner Manager Video Manager
Wordpress Affiliate Plugin Pic/Movie of the Day Fansign Generator Zip Manager
woj is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-02-2005, 05:26 AM   #11
Voodoo
♥ ♦ ♣ ♠
 
Voodoo's Avatar
 
Industry Role:
Join Date: Sep 2002
Posts: 10,592
WHEN WILL YOU LEARN!?!?!?!? "Quick Questions" NEVER have "quick answers".
__________________

"I'm selflessly supporting the common good, but only coincidentally looking out for No.1."
Voodoo is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.