Jump to content

display row result...


aviel131

Recommended Posts

i got row name "links" and its have links from textarea

now i want to display the links like this:

lets say i have link name members.facebook.com/blabla.php and members.facebook.com/blabl121a.php

i want to display title:

 

members.facebook.com

and the link here like <a href="members.facebook.com/blabla.php">

 

how can i do this?

Link to comment
https://forums.phpfreaks.com/topic/187079-display-row-result/
Share on other sites

You really need to clarify your question. Is this a database issue or a problem with your understanding of string manipulation, or a problem with your understanding of PHP, or ????

 

Let's see what code you have, and a describe on any pertinent database tables.

Link to comment
https://forums.phpfreaks.com/topic/187079-display-row-result/#findComment-987926
Share on other sites

$q=mysql_query("SELECT * FROM downloads WHERE id=5");

 

while ($row=mysql_fetch_array($q)) {

echo $row['links'];

}

 

its show me the all links

i want its make order in links and put lets say site "facebook" under title "facebook" and site "blabla.com" under title "blabla.com"

Link to comment
https://forums.phpfreaks.com/topic/187079-display-row-result/#findComment-987929
Share on other sites

First off, change your query to:

 

SELECT * FROM downloads WHERE id=5 ORDER BY links

 

 

This will sort them in ascending order.

 

Then it looks like you want to parse out the domain from the $row['links']; 

 

Something liike this ought to put you on the right track:

 

$domain = '';
while ($row=mysql_fetch_array($q)) {
  $t = parse_url($row['links']);
  if ($domain !== $t['host']) {
    $domain = $t['host'];
    echo "$domain\n";
  }
   echo '' . $row['links'] .  "\n";
}

 

 

Link to comment
https://forums.phpfreaks.com/topic/187079-display-row-result/#findComment-987938
Share on other sites

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.