GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   another PHP/MySQL question (https://gfy.com/showthread.php?t=599008)

poe 04-17-2006 10:13 AM

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! :thumbsup

poe 04-17-2006 10:14 AM

the name should still be displayed, just not the link

Voodoo 04-17-2006 10:15 AM

http://www.bookpool.com/covers/668/0764541668_500.gif

Read a book.

poe 04-17-2006 10:17 AM

Quote:

Originally Posted by Voodoo

:1orglaugh

Voodoo 04-17-2006 10:19 AM

Code:

if(isset($row['url'])){
echo "<a href=".$row['url']." title=".$row['title'].">".$row['name']."</a>";
}else{
echo "$row['name']";
}

Try this.

poe 04-17-2006 10:26 AM

Thanks, dude!

hmm, it doesn't produce any errors, but it doesn't work.. should i try something other than isset?

poe 04-17-2006 10:28 AM

switched around the if and else and tried empty()

that worked!

thanks!

poe 04-17-2006 10:30 AM

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 04-17-2006 10:41 AM

it's now 1041

Voodoo 04-17-2006 10:45 AM

Code:

if($row['url'] != empty){
echo "<a href=".$row['url']." title=".$row['title'].">".$row['name']."</a>";
}else{
echo "$row['name']";
}



All times are GMT -7. The time now is 03:25 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123