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 10-23-2011, 10:21 PM   #1
alan-l
Confirmed User
 
Join Date: May 2003
Location: look behind you
Posts: 2,477
PHP gods, I need your help please!

Need to fix this in a script and the developer is MIA, any help greatly appreciated. I have this line:

Code:
<?php echo $product['niche'][0]; ?>
which throws whatever I input in the admin area for that field. Like Niche: Latex Fetish.

However, if I don't input something in that field, the design gets screwed since the divs are floated or whatever, so what I need is just something like

Code:
if $product['niche'][0]; is filled, then use it, otherwise add N/A
I know it's something extremely easy, but I have no idea about PHP, so any help more han appreciated

Of course, thank you in advance
alan-l is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-23-2011, 10:24 PM   #2
KickAssJesse
Confirmed User
 
KickAssJesse's Avatar
 
Industry Role:
Join Date: Jul 2008
Location: Los Angeles
Posts: 942
PHP Code:
if ($product['niche'][0]) { echo $product['niche'][0]; } 
__________________

Contact - email: jesse~AT~atkcash~DOT~com - Skype: kickassjesse - ICQ: 386185547
ATK Cash $$$
KickAssJesse is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-23-2011, 10:27 PM   #3
alan-l
Confirmed User
 
Join Date: May 2003
Location: look behind you
Posts: 2,477
Quote:
Originally Posted by KickAssJesse View Post
PHP Code:
if ($product['niche'][0]) { echo $product['niche'][0]; } 
wow, thank you that was fast, but I really need to add something on that field, how do I make it show 'N/A' when field is empty?
alan-l is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-23-2011, 10:30 PM   #4
KickAssJesse
Confirmed User
 
KickAssJesse's Avatar
 
Industry Role:
Join Date: Jul 2008
Location: Los Angeles
Posts: 942
PHP Code:
if ($product['niche'][0]) { echo $product['niche'][0]; } 
else { echo 
'N/A'; } 
__________________

Contact - email: jesse~AT~atkcash~DOT~com - Skype: kickassjesse - ICQ: 386185547
ATK Cash $$$
KickAssJesse is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-23-2011, 10:30 PM   #5
Jakez
Confirmed User
 
Jakez's Avatar
 
Industry Role:
Join Date: Jan 2004
Location: oddfuturewolfgangkillthemall!!!!!!!
Posts: 5,656
Quote:
Originally Posted by KickAssJesse View Post
PHP Code:
if ($product['niche'][0]) { echo $product['niche'][0]; } 
PHP Code:
if ($product['niche'][0]) { echo $product['niche'][0]; } else { echo 'N/A'; } 
__________________
[email protected] - jakezdumb - 573689400

Killuminati
Jakez is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-23-2011, 10:34 PM   #6
alan-l
Confirmed User
 
Join Date: May 2003
Location: look behind you
Posts: 2,477
thank you guys, that worked like a charm!
alan-l is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-23-2011, 10:35 PM   #7
Tempest
Too lazy to set a custom title
 
Industry Role:
Join Date: May 2004
Location: West Coast, Canada.
Posts: 10,217
Code:
if( isset($product['niche'][0]) && $product['niche'][0] != ''){
    echo $product['niche'][0];
}else{
    echo 'N/A';
}
Tempest is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-23-2011, 10:45 PM   #8
blackmonsters
Making PHP work
 
blackmonsters's Avatar
 
Industry Role:
Join Date: Nov 2002
Location: 🌎🌅🌈🌇
Posts: 20,564
Quote:
Originally Posted by Tempest View Post
Code:
if( isset($product['niche'][0]) && $product['niche'][0] != ''){
    echo $product['niche'][0];
}else{
    echo 'N/A';
}
This is better.
__________________
Make Money with Porn
blackmonsters is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-23-2011, 11:34 PM   #9
dissipate
The Dirty Frenchman
 
dissipate's Avatar
 
Industry Role:
Join Date: Nov 2005
Location: Lost Angeles
Posts: 8,904
print !empty($product['niche'][0]) ? $product['niche'][0] : "N/A";
dissipate is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-24-2011, 12:20 AM   #10
V_RocKs
Damn Right I Kiss Ass!
 
Industry Role:
Join Date: Dec 2003
Location: Cowtown, USA
Posts: 32,409
Have we consulted the sanitation department on this yet?
V_RocKs is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-24-2011, 12:26 AM   #11
BIGTYMER
Junior Achiever
 
BIGTYMER's Avatar
 
Industry Role:
Join Date: Nov 2004
Location: Walled Garden
Posts: 17,066
Quote:
Originally Posted by V_RocKs View Post
Have we consulted the sanitation department on this yet?
As long as product isn't a user submitted variable he's good.
BIGTYMER 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.