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 Mark Forums Read
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 04-17-2006, 10:13 AM   #1
poe
Confirmed User
 
Join Date: Mar 2004
Posts: 455
another PHP/MySQL question

I am creating links for mysql data..

my code looks like this

Code:
echo "<a href=".$row['url']." title=".$row['title'].">".$row['name']."</a>";
now, sometimes there is no 'url' data for that entry.. how do make it so if there isn't, it doesn't display that entry as a link?

thanks!
__________________
poe is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-17-2006, 10:14 AM   #2
poe
Confirmed User
 
Join Date: Mar 2004
Posts: 455
the name should still be displayed, just not the link
__________________
poe is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-17-2006, 10:15 AM   #3
Voodoo
♥ ♦ ♣ ♠
 
Voodoo's Avatar
 
Industry Role:
Join Date: Sep 2002
Posts: 10,592


Read a book.
__________________

"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
Old 04-17-2006, 10:17 AM   #4
poe
Confirmed User
 
Join Date: Mar 2004
Posts: 455
Quote:
Originally Posted by Voodoo


Read a book.
__________________
poe is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-17-2006, 10:19 AM   #5
Voodoo
♥ ♦ ♣ ♠
 
Voodoo's Avatar
 
Industry Role:
Join Date: Sep 2002
Posts: 10,592
Code:
if(isset($row['url'])){
echo "<a href=".$row['url']." title=".$row['title'].">".$row['name']."</a>";
}else{
echo "$row['name']";
}
Try this.
__________________

"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
Old 04-17-2006, 10:26 AM   #6
poe
Confirmed User
 
Join Date: Mar 2004
Posts: 455
Thanks, dude!

hmm, it doesn't produce any errors, but it doesn't work.. should i try something other than isset?
__________________
poe is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-17-2006, 10:28 AM   #7
poe
Confirmed User
 
Join Date: Mar 2004
Posts: 455
switched around the if and else and tried empty()

that worked!

thanks!
__________________
poe is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-17-2006, 10:30 AM   #8
poe
Confirmed User
 
Join Date: Mar 2004
Posts: 455
also: i have a separator between each entry.. is there an if something() to check if it's the last entry, so the separator doesn't show up at the end?
__________________
poe is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-17-2006, 10:41 AM   #9
poe
Confirmed User
 
Join Date: Mar 2004
Posts: 455
it's now 1041
__________________
poe is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-17-2006, 10:45 AM   #10
Voodoo
♥ ♦ ♣ ♠
 
Voodoo's Avatar
 
Industry Role:
Join Date: Sep 2002
Posts: 10,592
Code:
if($row['url'] != empty){
echo "<a href=".$row['url']." title=".$row['title'].">".$row['name']."</a>";
}else{
echo "$row['name']";
}
__________________

"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
Thread Tools



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.