Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Projects > The Bug Tracker > Bug

Notices

Information on pet with most clicks works only sometimes Issue Tools
issueid=60 02-27-2017 06:23 PM
Member
Information on pet with most clicks works only sometimes
The script will sometimes show the wrong pet when choosing the one with the most clicks

I discovered this problem yesterday, and it's that showing the information of the pet with the most clicks will not always work, but there doesn't seem to be any pattern to when it works and when it doesn't.

PHP Code:
$topclicks $mysidia->db->select("owned_adoptables", array("totalclicks"), "Type='{$species}'""1 ORDER BY totalclicks DESC LIMIT 1")->fetchColumn();
    
$topadopt $mysidia->db->select("owned_adoptables", array("name"), "Type='{$species}'""1 ORDER BY totalclicks DESC LIMIT 1")->fetchColumn();
    
$topadoptowner $mysidia->db->select("owned_adoptables", array("owner"), "Type='{$species}'""1 ORDER BY totalclicks DESC LIMIT 1")->fetchColumn(); 
I use this code to get the name, name of the owner, and amount of clicks of the most clicked adoptable of that species. It will sometimes pick my pet, which doesn't have the most clicks. The problem is that I have the exact same line of code repeated throughout my php file, and sometimes it works and sometimes it does not.
PHP Code:
$topclicks $mysidia->db->select("owned_adoptables", array("totalclicks"), "Type='{$species}'""1 ORDER BY totalclicks DESC LIMIT 1")->fetchColumn();
    
$topadopt $mysidia->db->select("owned_adoptables", array("name"), "Type='{$species}'""1 ORDER BY totalclicks DESC LIMIT 1")->fetchColumn();
    
$topadoptowner $mysidia->db->select("owned_adoptables", array("owner"), "Type='{$species}'""1 ORDER BY totalclicks DESC LIMIT 1")->fetchColumn(); 
Issue Details
Project The Bug Tracker
Category Unknown
Status Unconfirmed
Priority 8
Affected Version Mys v1.3.4
Fixed Version (none)
Users able to reproduce bug 0
Users unable to reproduce bug 0
Assigned Users (none)
Tags (none)

03-24-2017 11:52 AM
ewe ewe is offline
Member
 
Some odd behavior might come from having multiple cells fetched. You could try selecting the adoptable code and making it an OwnedAdoptable.

$topclicks = $mysidia->db->select("owned_adoptables", array("aid"), "Type='{$species}'", "1 ORDER BY totalclicks DESC LIMIT 1")->fetchColumn();

$adopt = new OwnedAdoptable($topclicks);
Then use the OwnedAdoptable class attributes to fill in everything you need

When you fetch a column you're getting just the data in that cell. If you pick the AID you'll be able to make an OwnedAdoptable. You could also reduce your statement to:
$pet = $mysidia->db->select("owned_adoptables", array(), "Type='{$species}' ORDER BY RAND() LIMIT 1")->fetchObject();
Reply
03-31-2017 03:17 PM
Member
 
Im not a coder and don't know if this will be useful or if it will work for you, but for me it works:
PHP Code:
    $topclicks $mysidia->db->select("owned_adoptables", array("totalclicks"), "Type='{$species}' ORDER BY totalclicks DESC LIMIT 1")->fetchColumn();
    
$topadopt $mysidia->db->select("owned_adoptables", array("name"), "Type='{$species}' ORDER BY totalclicks DESC LIMIT 1")->fetchColumn();
    
$topadoptowner $mysidia->db->select("owned_adoptables", array("owner"), "Type='{$species}' ORDER BY totalclicks DESC LIMIT 1")->fetchColumn(); 
is the same code you provided for the encyclopedia i just removed the: ", "1 from each one and united Type with ORDER, don't know if is the correct way but that's how you can find it in the myadopts.php
and now is displaying the correct info
Reply
Reply

Issue Tools
Subscribe to this issue

All times are GMT -5. The time now is 11:22 PM.

Currently Active Users: 276 (0 members and 276 guests)
Threads: 4,080, Posts: 32,024, 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 - 2024, vBulletin Solutions Inc.
vBCommerce I v2.0.0 Gold ©2010, PixelFX Studios
vBCredits I v2.0.0 Gold ©2010, PixelFX Studios
Emoticons by darkmoon3636