Log in

View Full Version : Anyone care to enlighten me as to why 188 queries are used on a page?


Arianna
05-08-2010, 06:53 AM
I implemented a query-count-and-tracking system on my site. And boy, I was shocked.
The following is what you get if you load adopt.php. There are 3 adoptables up to adopt, but... well, look at the 188 queries...
188 queries were taken for this page. They are the following:
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_users WHERE username='Arianna'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_adoptables
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_groups WHERE gid = '1'
SELECT * FROM adopts_adoptables WHERE id='1'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_groups WHERE gid = '1'
SELECT * FROM adopts_adoptables WHERE id='2'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_groups WHERE gid = '1'
SELECT * FROM adopts_adoptables WHERE id='3'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_groups WHERE gid = '1'
SELECT * FROM adopts_adoptables WHERE id='4'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_groups WHERE gid = '1'
SELECT * FROM adopts_adoptables WHERE id='5'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_groups WHERE gid = '1'
SELECT * FROM adopts_adoptables WHERE id='6'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_groups WHERE gid = '1'
SELECT * FROM adopts_adoptables WHERE id='7'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_groups WHERE gid = '1'
SELECT * FROM adopts_adoptables WHERE id='8'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_groups WHERE gid = '1'
SELECT * FROM adopts_adoptables WHERE id='9'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_groups WHERE gid = '1'
SELECT * FROM adopts_adoptables WHERE id='10'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_groups WHERE gid = '1'
SELECT * FROM adopts_adoptables WHERE id='11'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_groups WHERE gid = '1'
SELECT * FROM adopts_adoptables WHERE id='12'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_groups WHERE gid = '1'
SELECT * FROM adopts_adoptables WHERE id='13'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_groups WHERE gid = '1'
SELECT * FROM adopts_adoptables WHERE id='14'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_groups WHERE gid = '1'
SELECT * FROM adopts_adoptables WHERE id='15'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_groups WHERE gid = '1'
SELECT * FROM adopts_adoptables WHERE id='16'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_groups WHERE gid = '1'
SELECT * FROM adopts_adoptables WHERE id='19'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_groups WHERE gid = '1'
SELECT * FROM adopts_adoptables WHERE id='18'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_groups WHERE gid = '1'
SELECT * FROM adopts_adoptables WHERE id='20'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_groups WHERE gid = '1'
SELECT * FROM adopts_adoptables WHERE id='21'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_groups WHERE gid = '1'
SELECT * FROM adopts_adoptables WHERE id='22'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_groups WHERE gid = '1'
SELECT * FROM adopts_adoptables WHERE id='23'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_groups WHERE gid = '1'
SELECT * FROM adopts_adoptables WHERE id='24'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_groups WHERE gid = '1'
SELECT * FROM adopts_adoptables WHERE id='25'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_groups WHERE gid = '1'
SELECT * FROM adopts_adoptables WHERE id='26'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_groups WHERE gid = '1'
SELECT * FROM adopts_adoptables WHERE id='27'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_groups WHERE gid = '1'
SELECT * FROM adopts_adoptables WHERE id='28'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_groups WHERE gid = '1'
SELECT * FROM adopts_adoptables WHERE id='29'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_groups WHERE gid = '1'
SELECT * FROM adopts_adoptables WHERE id='30'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_groups WHERE gid = '1'
SELECT * FROM adopts_adoptables WHERE id='31'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_groups WHERE gid = '1'
SELECT * FROM adopts_adoptables WHERE id='32'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_groups WHERE gid = '1'
SELECT * FROM adopts_adoptables WHERE id='33'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_groups WHERE gid = '1'
SELECT * FROM adopts_adoptables WHERE id='34'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_groups WHERE gid = '1'
SELECT * FROM adopts_adoptables WHERE id='35'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_groups WHERE gid = '1'
SELECT * FROM adopts_adoptables WHERE id='36'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_groups WHERE gid = '1'
SELECT * FROM adopts_adoptables WHERE id='38'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_messages WHERE touser='Arianna' and status='unread'
SELECT * FROM `adopts_users` WHERE `username`='Arianna'
SELECT * FROM adopts_users WHERE username = 'Arianna'
And for myadopts, it's this:
89 queries were taken for this page. They are the following:
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_users WHERE username='Arianna'
SELECT * FROM adopts_users WHERE username = 'Arianna'
SELECT * FROM adopts_owned_adoptables WHERE owner='Arianna' ORDER BY type, totalclicks DESC
SELECT * FROM adopts_adoptables, adopts_owned_adoptables, adopts_levels WHERE `adopts_owned_adoptables`.`aid` = 441 AND `adopts_owned_adoptables`.`type` = `adopts_adoptables`.`type` AND `adopts_levels`.`adoptiename` = `adopts_adoptables`.`type` AND `adopts_levels`.`thisislevel` = `adopts_owned_adoptables`.`currentlevel` LIMIT 0 , 30
SELECT * FROM adopts_adoptables, adopts_owned_adoptables, adopts_levels WHERE `adopts_owned_adoptables`.`aid` = 461 AND `adopts_owned_adoptables`.`type` = `adopts_adoptables`.`type` AND `adopts_levels`.`adoptiename` = `adopts_adoptables`.`type` AND `adopts_levels`.`thisislevel` = `adopts_owned_adoptables`.`currentlevel` LIMIT 0 , 30
SELECT * FROM adopts_adoptables, adopts_owned_adoptables, adopts_levels WHERE `adopts_owned_adoptables`.`aid` = 1268 AND `adopts_owned_adoptables`.`type` = `adopts_adoptables`.`type` AND `adopts_levels`.`adoptiename` = `adopts_adoptables`.`type` AND `adopts_levels`.`thisislevel` = `adopts_owned_adoptables`.`currentlevel` LIMIT 0 , 30
SELECT * FROM adopts_adoptables, adopts_owned_adoptables, adopts_levels WHERE `adopts_owned_adoptables`.`aid` = 1777 AND `adopts_owned_adoptables`.`type` = `adopts_adoptables`.`type` AND `adopts_levels`.`adoptiename` = `adopts_adoptables`.`type` AND `adopts_levels`.`thisislevel` = `adopts_owned_adoptables`.`currentlevel` LIMIT 0 , 30
SELECT * FROM adopts_adoptables, adopts_owned_adoptables, adopts_levels WHERE `adopts_owned_adoptables`.`aid` = 219 AND `adopts_owned_adoptables`.`type` = `adopts_adoptables`.`type` AND `adopts_levels`.`adoptiename` = `adopts_adoptables`.`type` AND `adopts_levels`.`thisislevel` = `adopts_owned_adoptables`.`currentlevel` LIMIT 0 , 30
SELECT * FROM adopts_adoptables, adopts_owned_adoptables, adopts_levels WHERE `adopts_owned_adoptables`.`aid` = 217 AND `adopts_owned_adoptables`.`type` = `adopts_adoptables`.`type` AND `adopts_levels`.`adoptiename` = `adopts_adoptables`.`type` AND `adopts_levels`.`thisislevel` = `adopts_owned_adoptables`.`currentlevel` LIMIT 0 , 30
SELECT * FROM adopts_adoptables, adopts_owned_adoptables, adopts_levels WHERE `adopts_owned_adoptables`.`aid` = 222 AND `adopts_owned_adoptables`.`type` = `adopts_adoptables`.`type` AND `adopts_levels`.`adoptiename` = `adopts_adoptables`.`type` AND `adopts_levels`.`thisislevel` = `adopts_owned_adoptables`.`currentlevel` LIMIT 0 , 30
SELECT * FROM adopts_adoptables, adopts_owned_adoptables, adopts_levels WHERE `adopts_owned_adoptables`.`aid` = 211 AND `adopts_owned_adoptables`.`type` = `adopts_adoptables`.`type` AND `adopts_levels`.`adoptiename` = `adopts_adoptables`.`type` AND `adopts_levels`.`thisislevel` = `adopts_owned_adoptables`.`currentlevel` LIMIT 0 , 30
SELECT * FROM adopts_adoptables, adopts_owned_adoptables, adopts_levels WHERE `adopts_owned_adoptables`.`aid` = 1095 AND `adopts_owned_adoptables`.`type` = `adopts_adoptables`.`type` AND `adopts_levels`.`adoptiename` = `adopts_adoptables`.`type` AND `adopts_levels`.`thisislevel` = `adopts_owned_adoptables`.`currentlevel` LIMIT 0 , 30
SELECT * FROM adopts_adoptables, adopts_owned_adoptables, adopts_levels WHERE `adopts_owned_adoptables`.`aid` = 2208 AND `adopts_owned_adoptables`.`type` = `adopts_adoptables`.`type` AND `adopts_levels`.`adoptiename` = `adopts_adoptables`.`type` AND `adopts_levels`.`thisislevel` = `adopts_owned_adoptables`.`currentlevel` LIMIT 0 , 30
SELECT * FROM adopts_adoptables, adopts_owned_adoptables, adopts_levels WHERE `adopts_owned_adoptables`.`aid` = 2203 AND `adopts_owned_adoptables`.`type` = `adopts_adoptables`.`type` AND `adopts_levels`.`adoptiename` = `adopts_adoptables`.`type` AND `adopts_levels`.`thisislevel` = `adopts_owned_adoptables`.`currentlevel` LIMIT 0 , 30
SELECT * FROM adopts_adoptables, adopts_owned_adoptables, adopts_levels WHERE `adopts_owned_adoptables`.`aid` = 1781 AND `adopts_owned_adoptables`.`type` = `adopts_adoptables`.`type` AND `adopts_levels`.`adoptiename` = `adopts_adoptables`.`type` AND `adopts_levels`.`thisislevel` = `adopts_owned_adoptables`.`currentlevel` LIMIT 0 , 30
SELECT * FROM adopts_adoptables, adopts_owned_adoptables, adopts_levels WHERE `adopts_owned_adoptables`.`aid` = 1273 AND `adopts_owned_adoptables`.`type` = `adopts_adoptables`.`type` AND `adopts_levels`.`adoptiename` = `adopts_adoptables`.`type` AND `adopts_levels`.`thisislevel` = `adopts_owned_adoptables`.`currentlevel` LIMIT 0 , 30
SELECT * FROM adopts_adoptables, adopts_owned_adoptables, adopts_levels WHERE `adopts_owned_adoptables`.`aid` = 289 AND `adopts_owned_adoptables`.`type` = `adopts_adoptables`.`type` AND `adopts_levels`.`adoptiename` = `adopts_adoptables`.`type` AND `adopts_levels`.`thisislevel` = `adopts_owned_adoptables`.`currentlevel` LIMIT 0 , 30
SELECT * FROM adopts_adoptables, adopts_owned_adoptables, adopts_levels WHERE `adopts_owned_adoptables`.`aid` = 681 AND `adopts_owned_adoptables`.`type` = `adopts_adoptables`.`type` AND `adopts_levels`.`adoptiename` = `adopts_adoptables`.`type` AND `adopts_levels`.`thisislevel` = `adopts_owned_adoptables`.`currentlevel` LIMIT 0 , 30
SELECT * FROM adopts_adoptables, adopts_owned_adoptables, adopts_levels WHERE `adopts_owned_adoptables`.`aid` = 187 AND `adopts_owned_adoptables`.`type` = `adopts_adoptables`.`type` AND `adopts_levels`.`adoptiename` = `adopts_adoptables`.`type` AND `adopts_levels`.`thisislevel` = `adopts_owned_adoptables`.`currentlevel` LIMIT 0 , 30
SELECT * FROM adopts_adoptables, adopts_owned_adoptables, adopts_levels WHERE `adopts_owned_adoptables`.`aid` = 218 AND `adopts_owned_adoptables`.`type` = `adopts_adoptables`.`type` AND `adopts_levels`.`adoptiename` = `adopts_adoptables`.`type` AND `adopts_levels`.`thisislevel` = `adopts_owned_adoptables`.`currentlevel` LIMIT 0 , 30
SELECT * FROM adopts_adoptables, adopts_owned_adoptables, adopts_levels WHERE `adopts_owned_adoptables`.`aid` = 2258 AND `adopts_owned_adoptables`.`type` = `adopts_adoptables`.`type` AND `adopts_levels`.`adoptiename` = `adopts_adoptables`.`type` AND `adopts_levels`.`thisislevel` = `adopts_owned_adoptables`.`currentlevel` LIMIT 0 , 30
SELECT * FROM adopts_adoptables, adopts_owned_adoptables, adopts_levels WHERE `adopts_owned_adoptables`.`aid` = 1638 AND `adopts_owned_adoptables`.`type` = `adopts_adoptables`.`type` AND `adopts_levels`.`adoptiename` = `adopts_adoptables`.`type` AND `adopts_levels`.`thisislevel` = `adopts_owned_adoptables`.`currentlevel` LIMIT 0 , 30
SELECT * FROM adopts_adoptables, adopts_owned_adoptables, adopts_levels WHERE `adopts_owned_adoptables`.`aid` = 712 AND `adopts_owned_adoptables`.`type` = `adopts_adoptables`.`type` AND `adopts_levels`.`adoptiename` = `adopts_adoptables`.`type` AND `adopts_levels`.`thisislevel` = `adopts_owned_adoptables`.`currentlevel` LIMIT 0 , 30
SELECT * FROM adopts_adoptables, adopts_owned_adoptables, adopts_levels WHERE `adopts_owned_adoptables`.`aid` = 738 AND `adopts_owned_adoptables`.`type` = `adopts_adoptables`.`type` AND `adopts_levels`.`adoptiename` = `adopts_adoptables`.`type` AND `adopts_levels`.`thisislevel` = `adopts_owned_adoptables`.`currentlevel` LIMIT 0 , 30
SELECT * FROM adopts_adoptables, adopts_owned_adoptables, adopts_levels WHERE `adopts_owned_adoptables`.`aid` = 1523 AND `adopts_owned_adoptables`.`type` = `adopts_adoptables`.`type` AND `adopts_levels`.`adoptiename` = `adopts_adoptables`.`type` AND `adopts_levels`.`thisislevel` = `adopts_owned_adoptables`.`currentlevel` LIMIT 0 , 30
SELECT * FROM adopts_adoptables, adopts_owned_adoptables, adopts_levels WHERE `adopts_owned_adoptables`.`aid` = 1778 AND `adopts_owned_adoptables`.`type` = `adopts_adoptables`.`type` AND `adopts_levels`.`adoptiename` = `adopts_adoptables`.`type` AND `adopts_levels`.`thisislevel` = `adopts_owned_adoptables`.`currentlevel` LIMIT 0 , 30
SELECT * FROM adopts_adoptables, adopts_owned_adoptables, adopts_levels WHERE `adopts_owned_adoptables`.`aid` = 10 AND `adopts_owned_adoptables`.`type` = `adopts_adoptables`.`type` AND `adopts_levels`.`adoptiename` = `adopts_adoptables`.`type` AND `adopts_levels`.`thisislevel` = `adopts_owned_adoptables`.`currentlevel` LIMIT 0 , 30
SELECT * FROM adopts_adoptables, adopts_owned_adoptables, adopts_levels WHERE `adopts_owned_adoptables`.`aid` = 9 AND `adopts_owned_adoptables`.`type` = `adopts_adoptables`.`type` AND `adopts_levels`.`adoptiename` = `adopts_adoptables`.`type` AND `adopts_levels`.`thisislevel` = `adopts_owned_adoptables`.`currentlevel` LIMIT 0 , 30
SELECT * FROM adopts_adoptables, adopts_owned_adoptables, adopts_levels WHERE `adopts_owned_adoptables`.`aid` = 154 AND `adopts_owned_adoptables`.`type` = `adopts_adoptables`.`type` AND `adopts_levels`.`adoptiename` = `adopts_adoptables`.`type` AND `adopts_levels`.`thisislevel` = `adopts_owned_adoptables`.`currentlevel` LIMIT 0 , 30
SELECT * FROM adopts_adoptables, adopts_owned_adoptables, adopts_levels WHERE `adopts_owned_adoptables`.`aid` = 258 AND `adopts_owned_adoptables`.`type` = `adopts_adoptables`.`type` AND `adopts_levels`.`adoptiename` = `adopts_adoptables`.`type` AND `adopts_levels`.`thisislevel` = `adopts_owned_adoptables`.`currentlevel` LIMIT 0 , 30
SELECT * FROM adopts_adoptables, adopts_owned_adoptables, adopts_levels WHERE `adopts_owned_adoptables`.`aid` = 221 AND `adopts_owned_adoptables`.`type` = `adopts_adoptables`.`type` AND `adopts_levels`.`adoptiename` = `adopts_adoptables`.`type` AND `adopts_levels`.`thisislevel` = `adopts_owned_adoptables`.`currentlevel` LIMIT 0 , 30
SELECT * FROM adopts_adoptables, adopts_owned_adoptables, adopts_levels WHERE `adopts_owned_adoptables`.`aid` = 259 AND `adopts_owned_adoptables`.`type` = `adopts_adoptables`.`type` AND `adopts_levels`.`adoptiename` = `adopts_adoptables`.`type` AND `adopts_levels`.`thisislevel` = `adopts_owned_adoptables`.`currentlevel` LIMIT 0 , 30
SELECT * FROM adopts_adoptables, adopts_owned_adoptables, adopts_levels WHERE `adopts_owned_adoptables`.`aid` = 224 AND `adopts_owned_adoptables`.`type` = `adopts_adoptables`.`type` AND `adopts_levels`.`adoptiename` = `adopts_adoptables`.`type` AND `adopts_levels`.`thisislevel` = `adopts_owned_adoptables`.`currentlevel` LIMIT 0 , 30
SELECT * FROM adopts_adoptables, adopts_owned_adoptables, adopts_levels WHERE `adopts_owned_adoptables`.`aid` = 460 AND `adopts_owned_adoptables`.`type` = `adopts_adoptables`.`type` AND `adopts_levels`.`adoptiename` = `adopts_adoptables`.`type` AND `adopts_levels`.`thisislevel` = `adopts_owned_adoptables`.`currentlevel` LIMIT 0 , 30
SELECT * FROM adopts_adoptables, adopts_owned_adoptables, adopts_levels WHERE `adopts_owned_adoptables`.`aid` = 1074 AND `adopts_owned_adoptables`.`type` = `adopts_adoptables`.`type` AND `adopts_levels`.`adoptiename` = `adopts_adoptables`.`type` AND `adopts_levels`.`thisislevel` = `adopts_owned_adoptables`.`currentlevel` LIMIT 0 , 30
SELECT * FROM adopts_adoptables, adopts_owned_adoptables, adopts_levels WHERE `adopts_owned_adoptables`.`aid` = 1072 AND `adopts_owned_adoptables`.`type` = `adopts_adoptables`.`type` AND `adopts_levels`.`adoptiename` = `adopts_adoptables`.`type` AND `adopts_levels`.`thisislevel` = `adopts_owned_adoptables`.`currentlevel` LIMIT 0 , 30
SELECT * FROM adopts_adoptables, adopts_owned_adoptables, adopts_levels WHERE `adopts_owned_adoptables`.`aid` = 1175 AND `adopts_owned_adoptables`.`type` = `adopts_adoptables`.`type` AND `adopts_levels`.`adoptiename` = `adopts_adoptables`.`type` AND `adopts_levels`.`thisislevel` = `adopts_owned_adoptables`.`currentlevel` LIMIT 0 , 30
SELECT * FROM adopts_adoptables, adopts_owned_adoptables, adopts_levels WHERE `adopts_owned_adoptables`.`aid` = 1176 AND `adopts_owned_adoptables`.`type` = `adopts_adoptables`.`type` AND `adopts_levels`.`adoptiename` = `adopts_adoptables`.`type` AND `adopts_levels`.`thisislevel` = `adopts_owned_adoptables`.`currentlevel` LIMIT 0 , 30
SELECT * FROM adopts_adoptables, adopts_owned_adoptables, adopts_levels WHERE `adopts_owned_adoptables`.`aid` = 1233 AND `adopts_owned_adoptables`.`type` = `adopts_adoptables`.`type` AND `adopts_levels`.`adoptiename` = `adopts_adoptables`.`type` AND `adopts_levels`.`thisislevel` = `adopts_owned_adoptables`.`currentlevel` LIMIT 0 , 30
SELECT * FROM adopts_adoptables, adopts_owned_adoptables, adopts_levels WHERE `adopts_owned_adoptables`.`aid` = 269 AND `adopts_owned_adoptables`.`type` = `adopts_adoptables`.`type` AND `adopts_levels`.`adoptiename` = `adopts_adoptables`.`type` AND `adopts_levels`.`thisislevel` = `adopts_owned_adoptables`.`currentlevel` LIMIT 0 , 30
SELECT * FROM adopts_adoptables, adopts_owned_adoptables, adopts_levels WHERE `adopts_owned_adoptables`.`aid` = 150 AND `adopts_owned_adoptables`.`type` = `adopts_adoptables`.`type` AND `adopts_levels`.`adoptiename` = `adopts_adoptables`.`type` AND `adopts_levels`.`thisislevel` = `adopts_owned_adoptables`.`currentlevel` LIMIT 0 , 30
SELECT * FROM adopts_adoptables, adopts_owned_adoptables, adopts_levels WHERE `adopts_owned_adoptables`.`aid` = 1269 AND `adopts_owned_adoptables`.`type` = `adopts_adoptables`.`type` AND `adopts_levels`.`adoptiename` = `adopts_adoptables`.`type` AND `adopts_levels`.`thisislevel` = `adopts_owned_adoptables`.`currentlevel` LIMIT 0 , 30
SELECT * FROM adopts_adoptables, adopts_owned_adoptables, adopts_levels WHERE `adopts_owned_adoptables`.`aid` = 1415 AND `adopts_owned_adoptables`.`type` = `adopts_adoptables`.`type` AND `adopts_levels`.`adoptiename` = `adopts_adoptables`.`type` AND `adopts_levels`.`thisislevel` = `adopts_owned_adoptables`.`currentlevel` LIMIT 0 , 30
SELECT * FROM adopts_adoptables, adopts_owned_adoptables, adopts_levels WHERE `adopts_owned_adoptables`.`aid` = 1082 AND `adopts_owned_adoptables`.`type` = `adopts_adoptables`.`type` AND `adopts_levels`.`adoptiename` = `adopts_adoptables`.`type` AND `adopts_levels`.`thisislevel` = `adopts_owned_adoptables`.`currentlevel` LIMIT 0 , 30
SELECT * FROM adopts_adoptables, adopts_owned_adoptables, adopts_levels WHERE `adopts_owned_adoptables`.`aid` = 1117 AND `adopts_owned_adoptables`.`type` = `adopts_adoptables`.`type` AND `adopts_levels`.`adoptiename` = `adopts_adoptables`.`type` AND `adopts_levels`.`thisislevel` = `adopts_owned_adoptables`.`currentlevel` LIMIT 0 , 30
SELECT * FROM adopts_adoptables, adopts_owned_adoptables, adopts_levels WHERE `adopts_owned_adoptables`.`aid` = 1089 AND `adopts_owned_adoptables`.`type` = `adopts_adoptables`.`type` AND `adopts_levels`.`adoptiename` = `adopts_adoptables`.`type` AND `adopts_levels`.`thisislevel` = `adopts_owned_adoptables`.`currentlevel` LIMIT 0 , 30
SELECT * FROM adopts_adoptables, adopts_owned_adoptables, adopts_levels WHERE `adopts_owned_adoptables`.`aid` = 1087 AND `adopts_owned_adoptables`.`type` = `adopts_adoptables`.`type` AND `adopts_levels`.`adoptiename` = `adopts_adoptables`.`type` AND `adopts_levels`.`thisislevel` = `adopts_owned_adoptables`.`currentlevel` LIMIT 0 , 30
SELECT * FROM adopts_adoptables, adopts_owned_adoptables, adopts_levels WHERE `adopts_owned_adoptables`.`aid` = 811 AND `adopts_owned_adoptables`.`type` = `adopts_adoptables`.`type` AND `adopts_levels`.`adoptiename` = `adopts_adoptables`.`type` AND `adopts_levels`.`thisislevel` = `adopts_owned_adoptables`.`currentlevel` LIMIT 0 , 30
SELECT * FROM adopts_adoptables, adopts_owned_adoptables, adopts_levels WHERE `adopts_owned_adoptables`.`aid` = 771 AND `adopts_owned_adoptables`.`type` = `adopts_adoptables`.`type` AND `adopts_levels`.`adoptiename` = `adopts_adoptables`.`type` AND `adopts_levels`.`thisislevel` = `adopts_owned_adoptables`.`currentlevel` LIMIT 0 , 30
SELECT * FROM adopts_adoptables, adopts_owned_adoptables, adopts_levels WHERE `adopts_owned_adoptables`.`aid` = 810 AND `adopts_owned_adoptables`.`type` = `adopts_adoptables`.`type` AND `adopts_levels`.`adoptiename` = `adopts_adoptables`.`type` AND `adopts_levels`.`thisislevel` = `adopts_owned_adoptables`.`currentlevel` LIMIT 0 , 30
SELECT * FROM adopts_adoptables, adopts_owned_adoptables, adopts_levels WHERE `adopts_owned_adoptables`.`aid` = 413 AND `adopts_owned_adoptables`.`type` = `adopts_adoptables`.`type` AND `adopts_levels`.`adoptiename` = `adopts_adoptables`.`type` AND `adopts_levels`.`thisislevel` = `adopts_owned_adoptables`.`currentlevel` LIMIT 0 , 30
SELECT * FROM adopts_adoptables, adopts_owned_adoptables, adopts_levels WHERE `adopts_owned_adoptables`.`aid` = 703 AND `adopts_owned_adoptables`.`type` = `adopts_adoptables`.`type` AND `adopts_levels`.`adoptiename` = `adopts_adoptables`.`type` AND `adopts_levels`.`thisislevel` = `adopts_owned_adoptables`.`currentlevel` LIMIT 0 , 30
SELECT * FROM adopts_adoptables, adopts_owned_adoptables, adopts_levels WHERE `adopts_owned_adoptables`.`aid` = 148 AND `adopts_owned_adoptables`.`type` = `adopts_adoptables`.`type` AND `adopts_levels`.`adoptiename` = `adopts_adoptables`.`type` AND `adopts_levels`.`thisislevel` = `adopts_owned_adoptables`.`currentlevel` LIMIT 0 , 30
SELECT * FROM adopts_adoptables, adopts_owned_adoptables, adopts_levels WHERE `adopts_owned_adoptables`.`aid` = 213 AND `adopts_owned_adoptables`.`type` = `adopts_adoptables`.`type` AND `adopts_levels`.`adoptiename` = `adopts_adoptables`.`type` AND `adopts_levels`.`thisislevel` = `adopts_owned_adoptables`.`currentlevel` LIMIT 0 , 30
SELECT * FROM adopts_adoptables, adopts_owned_adoptables, adopts_levels WHERE `adopts_owned_adoptables`.`aid` = 513 AND `adopts_owned_adoptables`.`type` = `adopts_adoptables`.`type` AND `adopts_levels`.`adoptiename` = `adopts_adoptables`.`type` AND `adopts_levels`.`thisislevel` = `adopts_owned_adoptables`.`currentlevel` LIMIT 0 , 30
SELECT * FROM adopts_adoptables, adopts_owned_adoptables, adopts_levels WHERE `adopts_owned_adoptables`.`aid` = 392 AND `adopts_owned_adoptables`.`type` = `adopts_adoptables`.`type` AND `adopts_levels`.`adoptiename` = `adopts_adoptables`.`type` AND `adopts_levels`.`thisislevel` = `adopts_owned_adoptables`.`currentlevel` LIMIT 0 , 30
SELECT * FROM adopts_adoptables, adopts_owned_adoptables, adopts_levels WHERE `adopts_owned_adoptables`.`aid` = 514 AND `adopts_owned_adoptables`.`type` = `adopts_adoptables`.`type` AND `adopts_levels`.`adoptiename` = `adopts_adoptables`.`type` AND `adopts_levels`.`thisislevel` = `adopts_owned_adoptables`.`currentlevel` LIMIT 0 , 30
SELECT * FROM adopts_adoptables, adopts_owned_adoptables, adopts_levels WHERE `adopts_owned_adoptables`.`aid` = 1073 AND `adopts_owned_adoptables`.`type` = `adopts_adoptables`.`type` AND `adopts_levels`.`adoptiename` = `adopts_adoptables`.`type` AND `adopts_levels`.`thisislevel` = `adopts_owned_adoptables`.`currentlevel` LIMIT 0 , 30
SELECT * FROM adopts_adoptables, adopts_owned_adoptables, adopts_levels WHERE `adopts_owned_adoptables`.`aid` = 1137 AND `adopts_owned_adoptables`.`type` = `adopts_adoptables`.`type` AND `adopts_levels`.`adoptiename` = `adopts_adoptables`.`type` AND `adopts_levels`.`thisislevel` = `adopts_owned_adoptables`.`currentlevel` LIMIT 0 , 30
SELECT * FROM adopts_adoptables, adopts_owned_adoptables, adopts_levels WHERE `adopts_owned_adoptables`.`aid` = 1136 AND `adopts_owned_adoptables`.`type` = `adopts_adoptables`.`type` AND `adopts_levels`.`adoptiename` = `adopts_adoptables`.`type` AND `adopts_levels`.`thisislevel` = `adopts_owned_adoptables`.`currentlevel` LIMIT 0 , 30
SELECT * FROM adopts_adoptables, adopts_owned_adoptables, adopts_levels WHERE `adopts_owned_adoptables`.`aid` = 1135 AND `adopts_owned_adoptables`.`type` = `adopts_adoptables`.`type` AND `adopts_levels`.`adoptiename` = `adopts_adoptables`.`type` AND `adopts_levels`.`thisislevel` = `adopts_owned_adoptables`.`currentlevel` LIMIT 0 , 30
SELECT * FROM adopts_adoptables, adopts_owned_adoptables, adopts_levels WHERE `adopts_owned_adoptables`.`aid` = 2209 AND `adopts_owned_adoptables`.`type` = `adopts_adoptables`.`type` AND `adopts_levels`.`adoptiename` = `adopts_adoptables`.`type` AND `adopts_levels`.`thisislevel` = `adopts_owned_adoptables`.`currentlevel` LIMIT 0 , 30
SELECT * FROM adopts_adoptables, adopts_owned_adoptables, adopts_levels WHERE `adopts_owned_adoptables`.`aid` = 2207 AND `adopts_owned_adoptables`.`type` = `adopts_adoptables`.`type` AND `adopts_levels`.`adoptiename` = `adopts_adoptables`.`type` AND `adopts_levels`.`thisislevel` = `adopts_owned_adoptables`.`currentlevel` LIMIT 0 , 30
SELECT * FROM adopts_adoptables, adopts_owned_adoptables, adopts_levels WHERE `adopts_owned_adoptables`.`aid` = 1779 AND `adopts_owned_adoptables`.`type` = `adopts_adoptables`.`type` AND `adopts_levels`.`adoptiename` = `adopts_adoptables`.`type` AND `adopts_levels`.`thisislevel` = `adopts_owned_adoptables`.`currentlevel` LIMIT 0 , 30
SELECT * FROM adopts_adoptables, adopts_owned_adoptables, adopts_levels WHERE `adopts_owned_adoptables`.`aid` = 1780 AND `adopts_owned_adoptables`.`type` = `adopts_adoptables`.`type` AND `adopts_levels`.`adoptiename` = `adopts_adoptables`.`type` AND `adopts_levels`.`thisislevel` = `adopts_owned_adoptables`.`currentlevel` LIMIT 0 , 30
SELECT * FROM adopts_adoptables, adopts_owned_adoptables, adopts_levels WHERE `adopts_owned_adoptables`.`aid` = 973 AND `adopts_owned_adoptables`.`type` = `adopts_adoptables`.`type` AND `adopts_levels`.`adoptiename` = `adopts_adoptables`.`type` AND `adopts_levels`.`thisislevel` = `adopts_owned_adoptables`.`currentlevel` LIMIT 0 , 30
SELECT * FROM adopts_adoptables, adopts_owned_adoptables, adopts_levels WHERE `adopts_owned_adoptables`.`aid` = 1066 AND `adopts_owned_adoptables`.`type` = `adopts_adoptables`.`type` AND `adopts_levels`.`adoptiename` = `adopts_adoptables`.`type` AND `adopts_levels`.`thisislevel` = `adopts_owned_adoptables`.`currentlevel` LIMIT 0 , 30
SELECT * FROM adopts_adoptables, adopts_owned_adoptables, adopts_levels WHERE `adopts_owned_adoptables`.`aid` = 879 AND `adopts_owned_adoptables`.`type` = `adopts_adoptables`.`type` AND `adopts_levels`.`adoptiename` = `adopts_adoptables`.`type` AND `adopts_levels`.`thisislevel` = `adopts_owned_adoptables`.`currentlevel` LIMIT 0 , 30
SELECT * FROM adopts_adoptables, adopts_owned_adoptables, adopts_levels WHERE `adopts_owned_adoptables`.`aid` = 1094 AND `adopts_owned_adoptables`.`type` = `adopts_adoptables`.`type` AND `adopts_levels`.`adoptiename` = `adopts_adoptables`.`type` AND `adopts_levels`.`thisislevel` = `adopts_owned_adoptables`.`currentlevel` LIMIT 0 , 30
SELECT * FROM adopts_adoptables, adopts_owned_adoptables, adopts_levels WHERE `adopts_owned_adoptables`.`aid` = 880 AND `adopts_owned_adoptables`.`type` = `adopts_adoptables`.`type` AND `adopts_levels`.`adoptiename` = `adopts_adoptables`.`type` AND `adopts_levels`.`thisislevel` = `adopts_owned_adoptables`.`currentlevel` LIMIT 0 , 30
SELECT * FROM adopts_adoptables, adopts_owned_adoptables, adopts_levels WHERE `adopts_owned_adoptables`.`aid` = 1270 AND `adopts_owned_adoptables`.`type` = `adopts_adoptables`.`type` AND `adopts_levels`.`adoptiename` = `adopts_adoptables`.`type` AND `adopts_levels`.`thisislevel` = `adopts_owned_adoptables`.`currentlevel` LIMIT 0 , 30
SELECT * FROM adopts_adoptables, adopts_owned_adoptables, adopts_levels WHERE `adopts_owned_adoptables`.`aid` = 1272 AND `adopts_owned_adoptables`.`type` = `adopts_adoptables`.`type` AND `adopts_levels`.`adoptiename` = `adopts_adoptables`.`type` AND `adopts_levels`.`thisislevel` = `adopts_owned_adoptables`.`currentlevel` LIMIT 0 , 30
SELECT * FROM adopts_adoptables, adopts_owned_adoptables, adopts_levels WHERE `adopts_owned_adoptables`.`aid` = 1271 AND `adopts_owned_adoptables`.`type` = `adopts_adoptables`.`type` AND `adopts_levels`.`adoptiename` = `adopts_adoptables`.`type` AND `adopts_levels`.`thisislevel` = `adopts_owned_adoptables`.`currentlevel` LIMIT 0 , 30
SELECT * FROM adopts_adoptables, adopts_owned_adoptables, adopts_levels WHERE `adopts_owned_adoptables`.`aid` = 270 AND `adopts_owned_adoptables`.`type` = `adopts_adoptables`.`type` AND `adopts_levels`.`adoptiename` = `adopts_adoptables`.`type` AND `adopts_levels`.`thisislevel` = `adopts_owned_adoptables`.`currentlevel` LIMIT 0 , 30
SELECT * FROM adopts_adoptables, adopts_owned_adoptables, adopts_levels WHERE `adopts_owned_adoptables`.`aid` = 149 AND `adopts_owned_adoptables`.`type` = `adopts_adoptables`.`type` AND `adopts_levels`.`adoptiename` = `adopts_adoptables`.`type` AND `adopts_levels`.`thisislevel` = `adopts_owned_adoptables`.`currentlevel` LIMIT 0 , 30
SELECT * FROM adopts_adoptables, adopts_owned_adoptables, adopts_levels WHERE `adopts_owned_adoptables`.`aid` = 208 AND `adopts_owned_adoptables`.`type` = `adopts_adoptables`.`type` AND `adopts_levels`.`adoptiename` = `adopts_adoptables`.`type` AND `adopts_levels`.`thisislevel` = `adopts_owned_adoptables`.`currentlevel` LIMIT 0 , 30
SELECT * FROM adopts_adoptables, adopts_owned_adoptables, adopts_levels WHERE `adopts_owned_adoptables`.`aid` = 214 AND `adopts_owned_adoptables`.`type` = `adopts_adoptables`.`type` AND `adopts_levels`.`adoptiename` = `adopts_adoptables`.`type` AND `adopts_levels`.`thisislevel` = `adopts_owned_adoptables`.`currentlevel` LIMIT 0 , 30
SELECT * FROM adopts_adoptables, adopts_owned_adoptables, adopts_levels WHERE `adopts_owned_adoptables`.`aid` = 1244 AND `adopts_owned_adoptables`.`type` = `adopts_adoptables`.`type` AND `adopts_levels`.`adoptiename` = `adopts_adoptables`.`type` AND `adopts_levels`.`thisislevel` = `adopts_owned_adoptables`.`currentlevel` LIMIT 0 , 30
SELECT * FROM adopts_adoptables, adopts_owned_adoptables, adopts_levels WHERE `adopts_owned_adoptables`.`aid` = 186 AND `adopts_owned_adoptables`.`type` = `adopts_adoptables`.`type` AND `adopts_levels`.`adoptiename` = `adopts_adoptables`.`type` AND `adopts_levels`.`thisislevel` = `adopts_owned_adoptables`.`currentlevel` LIMIT 0 , 30
SELECT * FROM adopts_adoptables, adopts_owned_adoptables, adopts_levels WHERE `adopts_owned_adoptables`.`aid` = 256 AND `adopts_owned_adoptables`.`type` = `adopts_adoptables`.`type` AND `adopts_levels`.`adoptiename` = `adopts_adoptables`.`type` AND `adopts_levels`.`thisislevel` = `adopts_owned_adoptables`.`currentlevel` LIMIT 0 , 30
SELECT * FROM adopts_adoptables, adopts_owned_adoptables, adopts_levels WHERE `adopts_owned_adoptables`.`aid` = 673 AND `adopts_owned_adoptables`.`type` = `adopts_adoptables`.`type` AND `adopts_levels`.`adoptiename` = `adopts_adoptables`.`type` AND `adopts_levels`.`thisislevel` = `adopts_owned_adoptables`.`currentlevel` LIMIT 0 , 30
SELECT * FROM adopts_adoptables, adopts_owned_adoptables, adopts_levels WHERE `adopts_owned_adoptables`.`aid` = 1075 AND `adopts_owned_adoptables`.`type` = `adopts_adoptables`.`type` AND `adopts_levels`.`adoptiename` = `adopts_adoptables`.`type` AND `adopts_levels`.`thisislevel` = `adopts_owned_adoptables`.`currentlevel` LIMIT 0 , 30
SELECT * FROM adopts_adoptables, adopts_owned_adoptables, adopts_levels WHERE `adopts_owned_adoptables`.`aid` = 1637 AND `adopts_owned_adoptables`.`type` = `adopts_adoptables`.`type` AND `adopts_levels`.`adoptiename` = `adopts_adoptables`.`type` AND `adopts_levels`.`thisislevel` = `adopts_owned_adoptables`.`currentlevel` LIMIT 0 , 30
SELECT * FROM adopts_adoptables, adopts_owned_adoptables, adopts_levels WHERE `adopts_owned_adoptables`.`aid` = 704 AND `adopts_owned_adoptables`.`type` = `adopts_adoptables`.`type` AND `adopts_levels`.`adoptiename` = `adopts_adoptables`.`type` AND `adopts_levels`.`thisislevel` = `adopts_owned_adoptables`.`currentlevel` LIMIT 0 , 30
SELECT * FROM adopts_users WHERE username = 'Arianna'

How is this /happening/? It's disgusting. 188 queries. :( No wonder my web host suspended me a few months ago.
7 queries are taken for a page with nothing on it, 9 for the index, and 90 queries (0.o) for myadopts. The first two are acceptable, these aren't.
Is there any way I can stop this? (I'm rewriting the whole script for TwigAdopts anyway, but I want to have this stopped.)

BMR777
05-08-2010, 12:00 PM
Do you have any 3rd party modifications made to these files, such as additional mods or features that you have installed from the community? Some of these queries I do not recognize as being used on the stock script. If you could please let me see the PHP code for both your adopt.php and myadopts.php files perhaps I could help figure out where all the queries are coming from though. I am especially puzzled by the many duplicate queries in succession, because usually in my code I will do a query once, save the result and then use that rather than doing multiple queries for the same data.

Also, do you have a link to this query tracker program? Are all of these queries from one pageload, or does your query tracker count from multiple page loads?

Arianna
05-09-2010, 01:51 AM
I don't have any additional mods installed, and after going through the script I realized that it was selecting every single adoptable (select * from adoptables) and only then checking (with three queries a piece, of course) if it could be adopted.

I think that the problem is, generally, is that for every adoptable it is calling canadopt($aid, "showing", $promocode), which is 3 queries a piece. As for myadopts, the problem is getcurrentimage($id), because this takes a query per pet. I'm working on editing the code now, but since I have so many modifications already (to reduce queries :P) I'm not sure I'll share it.

The query tracking was done by me, but it's really simple - $query_list[] = $query; $query_count++; is inserted after every query (regexes were helpful for putting them in) and when I show the page, I echo all of them. A page without any additional queries is 6 queries, 5 of which are 'select * from users where username = {$username}'. xP

Arianna
05-09-2010, 06:31 AM
For myadopts.php I came up with the following solution:
if($act == ""){
// No action specified, we just show all the adoptables with a manage link
$title = "Your Adoptables";
$page = $lang_adoptmanagement;
// We need to get all of the user's adoptables from the database and display them...
$query = "SELECT * FROM adopts_owned_adoptables, adopts_adoptables, adopts_levels WHERE adopts_owned_adoptables.owner = '{$loggedinname}' AND adopts_adoptables.type = adopts_owned_adoptables.type AND adopts_levels.thisislevel = adopts_owned_adoptables.currentlevel AND adopts_levels.adoptiename = adopts_adoptables.type";
$result = mysql_query($query);
$query_list[] = $query;
$query_count++;
$num = mysql_numrows($result);
$page .= "<table>";
//Loop out code
$i=0;
while ($i < $num) {
$aid=@mysql_result($result,$i,"adopts_owned_adoptables.aid");
$currentlevel=@mysql_result($result,$i,"adopts_owned_adoptables.currentlevel");
$gender=@mysql_result($result,$i,"adopts_owned_adoptables.gender");
$type=@mysql_result($result,$i,"adopts_owned_adoptables.type");
$name=@mysql_result($result,$i,"adopts_owned_adoptables.name");
$eggimage=@mysql_result($result,$i,"adopts_adoptables.eggimage");
$usealternates=@mysql_result($result,$i,"adopts_owned_adoptables.usealternates");
$totalclicks=@mysql_result($result,$i,"adopts_owned_adoptables.totalclicks");
$primaryimage=@mysql_result($result,$i,"adopts_levels.primaryimage");
$alternateimage=@mysql_result($result,$i,"adopts_levels.alternateimage");
if ($usealternates=='yes') { $image = $alternateimage; }
else { $image = $primaryimage; }
if ($currentlevel==0) { $image = $eggimage; }
if ($image=='') { $image = $primaryimage; }
$page .="<tr><td style='width: 90px;'>".$name."</td><td style='width: 80px'><a href='myadopts.php?act=manage&id=".$aid."'><img src='".$image."'></a></td><td style='width: 55px;'><img src='picuploads/".$gender.".png'></td><td style='width: 80px'>".$type."</td><td style='width:50px'>".$totalclicks."</td></tr>";
$i++;
}
$page .= "</table>";
}
It takes 1 query, as opposed to 84.
As for adopt.php, I've reduced it to 2 queries a pet (7 a page for 3 pets), but I'm working on getting it into one join query.

Seapyramid
05-13-2010, 04:54 PM
This is what I mentioned months ago when we optimized the whole script. It is in the way the script is written and took quite a long time to optimize it. Zami at PGS is working on a new script, optimized with full features such as coin, paypal ipn, trade, genders items & such but it won't be free once she has it complete.

Arianna
05-14-2010, 09:21 AM
Yeah, only now do I understand, Sea. :/ I really don't want to be mean, but a lot of this code is just really bad.
What does PGS stand for?
I wrote a petsite script with pretty much all the features here and a few more, but it's not grow-by-click or OOP. I'm coding a new one, now, but it's for another site. While I have learned a lot by working on this script, it isn't the best-written script out there.