grozanc Posted April 4, 2009 Share Posted April 4, 2009 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 Link to comment https://forums.phpfreaks.com/topic/152594-solved-need-help-displaying-query-results/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.