Jump to content

[SOLVED] Need help displaying Query Results


grozanc

Recommended Posts

Hello All,

 

I'm working on a web site that needs to list all the rows in a table. This is how I have been doing it.

 

# $query  = "SELECT link, page_title, page_content, path FROM $table WHERE approved ORDER BY page_title ASC";
# $result = mysql_query($query) or die('Error, query failed');
# if (mysql_num_rows($result) > 0 ) {
# while(list($link, $page_title, $page_content, $path ) = mysql_fetch_array($result))
# $string .= "<a href=".$link." class=maplinkrev target=_blank>".$page_title."</a><br>".nl2br($row['page_content'])."<br><br>";  
# }
# echo "$string";

 

This works fine. However, not every entry will always have a link and I need to figure out how to use an if statement to display the link only when it's in the table row but still display the page title. I have no idea of where to begin to look to find the answer to this! Any help would be appreciated.

 

Regards,

Gary

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.