Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Mysidia Adoptables > Questions and Supports

Notices

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #4  
Old 05-09-2010, 06:31 AM
Arianna's Avatar
Arianna Arianna is offline
Dev Staff
 
Join Date: Sep 2009
Posts: 334
Gender: Female
Credits: 33,187
Arianna will become famous soon enough
Default RE: Anyone care to enlighten me as to why 188 queries are used on a page?

For myadopts.php I came up with the following solution:
PHP Code:
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.
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help Making Stats Page = Click Page & Lineages? squiggler Questions and Supports 2 02-22-2014 04:42 AM
Adopt Page & Pound Page change? tahbikat Questions and Supports 3 02-14-2014 03:19 PM
Troubles with queries pachoofoosh Questions and Supports 4 08-05-2013 11:32 AM
Question about Queries? Tsuntsun Questions and Supports 2 11-03-2011 01:57 PM
MySQL queries ..? Quillink Questions and Supports 3 07-11-2009 11:47 AM


All times are GMT -5. The time now is 02:12 AM.

Currently Active Users: 3408 (0 members and 3408 guests)
Threads: 4,081, Posts: 32,032, Members: 2,016
Welcome to our newest members, jolob.
BETA





What's New?

What's Hot?

What's Popular?


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
vBCommerce I v2.0.0 Gold ©2010, PixelFX Studios
vBCredits I v2.0.0 Gold ©2010, PixelFX Studios
Emoticons by darkmoon3636