12-09-2007, 02:42 AM
|
#2 (permalink)
|
|
La Vida es Sueño
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
|
Before I start, welcome to the community! I've just had a client showing me lots of NSFW websites for a project he wants me to do, I come onto TalkPHP and there we go - more of the filth!
How about you place them into an array and that way you don't need to run the query again, just loop through the array.
php Code:
$res = "SELECT COUNT(*) as count, table_traffic.* FROM table_traffic, table_traffic2ip WHERE table_traffic.traffic_id=table_traffic2ip.traffic_id AND table_traffic.traffic_status='1' GROUP BY table_traffic.traffic_id ORDER BY count DESC LIMIT 20"; $list_traffic = mysql_query($res) or die(mysql_error()); $sites = array(); while($row = mysql_fetch_array($list_traffic)){ $sites[ $row[ 'traffic_title']] = $row[ 'traffic_url']; }foreach($sites as $title => $url){ echo "<a href='". $url. "' class='popular_tags' target='_blank'>". $title. "</a>"; }
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
|
|
|