![]() |
Two same queries, cut down to one?
Hello,
Basically, i have the same query displayed twice on one page. 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";However, i have the query on the sidebar on the right, and the same query at the bottom... and if you go on the site, and refresh.. there are 80~ requests for the homepage.. so.. just trying to cut it down, even just a little :P |
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:
|
Alternatively, you could use the mysql_data_seek function.
PHP Code:
|
| All times are GMT. The time now is 09:06 PM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0