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