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

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.