Mysidia Adoptables Support Forum  

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

Notices

Reply
 
Thread Tools Display Modes
  #11  
Old 04-10-2012, 12:38 AM
SilverDragonTears's Avatar
SilverDragonTears SilverDragonTears is offline
I am your Nemesis.
 
Join Date: Jun 2011
Posts: 1,113
Gender: Female
Credits: 110,789
SilverDragonTears is on a distinguished road
Default

One more thing and then I surely will. This sort script worked fine on my old site... Now it's telling me Fatal error: Call to a member function fetchObject() on a non-object in /home/taleofdr/public_html/sort.php on line 51

Code:
<?php 

include("functions/functions.php");
include("functions/functions_users.php"); 
include("functions/functions_adopts.php"); 
include("classes/class_pagination.php"); 
include("css/pagination.css"); 
include("inc/sort.php"); 
include("inc/lang.php"); 

//***************// 
//  START SCRIPT // 
//***************// 
$id = $_GET["id"]; 
$act = $_GET["act"]; 
$more = $_GET["more"]; 
$page = $_GET["page"]; 




if($isloggedin == "yes") 
{ 
$article_content = "<p id='activate_sort' style='cursor: pointer'> 
                                 Click here to sort your dragons
                            </p> 
                            <table>"; 

        // We need to get all of the user's adoptables from the database and display them... 
         $query = "SELECT *   
                    FROM {$prefix}owned_adoptables   
                    LEFT JOIN {$prefix}sort_adoptables   
                        ON {$prefix}owned_adoptables.aid = {$prefix}sort_adoptables.adoptable_id  
                    INNER JOIN {$prefix}levels   
                        ON {$prefix}levels.thisislevel = {$prefix}owned_adoptables.currentlevel  
                    INNER JOIN {$prefix}adoptables  
                        ON {$prefix}owned_adoptables.type = {$prefix}adoptables.type  
                    WHERE {$prefix}owned_adoptables.owner = '{$loggedinname}'   
                    AND {$prefix}levels.adoptiename = {$prefix}adoptables.type  
                    ORDER BY {$prefix}sort_adoptables.sorting_id"; 
        $stmt = $adopts->query($query); 
         

$cols = 6; //the number of columns 

        do{ 
        $article_content .= "<tr>"; 
        for($i=1;$i<=$cols;$i++){  
         

        if($row = $stmt->fetchObject()){ 
            if($row->usealternates == 'yes') $image = $row->alternateimage;  
            else $image = $row->primaryimage;  
            if($row->currentlevel == 0) $image = $row->eggimage;  
            if($image=='') $image = $row->primaryimage;  
                          
            $article_content .= " <td class='sortable_adoptables' style='width: 40px;'>
                        <table id='orderaid_{$row->aid}'><tr> 
<td><img src='{$image}' width='30px' height='30px'><br>{$row->name}</td>  
                           </tr> </table></td>";    
        } 
else{ 
            $article_content .= "<td>&nbsp;</td>";    //If there are no more records at the end, add a blank column 
            } 
        } 
    } while($row); 
        $article_content .= "</table>";  
          
      }   
         
//***************// 
//  OUTPUT PAGE  // 
//***************// 

echo showpage($article_title, $article_content, $date); 

?>
__________________

Check out SilvaTales
Reply With Quote
  #12  
Old 04-10-2012, 12:51 AM
Hall of Famer's Avatar
Hall of Famer Hall of Famer is offline
Administrator, Lead Coder
 
Join Date: Dec 2008
Location: South Brunswick
Posts: 4,448
Gender: Male
Credits: 575,845
Hall of Famer is on a distinguished road
Default

Well replace every {$prefix} by ".constant('PREFIX')." and it should work for you. The reason why we are using PHP constants is that we do not need to define superglobals for database information used in functions and classes. You do not see $GLOBALS['prefix'] anymore from functions in Mys v1.3.1. Once the User class is available we will get rid of more superglobals, although some superglobals will always remain, such as $GLOBALS['adopts'] since you cannot define a constant object.
__________________


Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site.
Reply With Quote
  #13  
Old 04-10-2012, 12:54 AM
SilverDragonTears's Avatar
SilverDragonTears SilverDragonTears is offline
I am your Nemesis.
 
Join Date: Jun 2011
Posts: 1,113
Gender: Female
Credits: 110,789
SilverDragonTears is on a distinguished road
Default

See, I must be tired. I tried that before I posted and I must have missed one b.c it still wasn't working. Thank you for all your help tonight HoF :) My members will thank you!
__________________

Check out SilvaTales
Reply With Quote
  #14  
Old 04-10-2012, 01:08 AM
Hall of Famer's Avatar
Hall of Famer Hall of Famer is offline
Administrator, Lead Coder
 
Join Date: Dec 2008
Location: South Brunswick
Posts: 4,448
Gender: Male
Credits: 575,845
Hall of Famer is on a distinguished road
Default

Still the same error? Post your script file after you've modified the SQL query using constants, I will see if something else is wrong.
__________________


Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site.
Reply With Quote
  #15  
Old 04-10-2012, 01:14 AM
SilverDragonTears's Avatar
SilverDragonTears SilverDragonTears is offline
I am your Nemesis.
 
Join Date: Jun 2011
Posts: 1,113
Gender: Female
Credits: 110,789
SilverDragonTears is on a distinguished road
Default

No it's working now :) The only issue I'm having now is I don't think that the sort id's are updating into the db

Code:
<?php

include("functions/functions.php");
include("functions/functions_users.php");
include("functions/functions_adopts.php");
include("classes/class_pagination.php");
include("css/pagination.css");
include("inc/lang.php");


//***************//
//  START SCRIPT //
//***************//

if ($_POST)
{
	
	$userID = $_COOKIE['auid'];

	foreach($_POST['orderaid'] as $orderID => $aid)
	{
		
		$adopts->query('REPLACE INTO ' . $prefix . 'sort_adoptables (`user_id`, `adoptable_id`, `sorting_id`) 
									VALUES ("' . addslashes($userID) . '", "' . addslashes($aid) . '", "' . addslashes($orderID) . '")');

		
	}
	
	echo '<p>Adoptables have been rearranged</p>';
	
}
?>
__________________

Check out SilvaTales
Reply With Quote
  #16  
Old 04-10-2012, 01:19 AM
Hall of Famer's Avatar
Hall of Famer Hall of Famer is offline
Administrator, Lead Coder
 
Join Date: Dec 2008
Location: South Brunswick
Posts: 4,448
Gender: Male
Credits: 575,845
Hall of Famer is on a distinguished road
Default

Of course its not updating the database when you still use $prefix in your sql query. XD
__________________


Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site.
Reply With Quote
  #17  
Old 04-10-2012, 01:19 AM
SilverDragonTears's Avatar
SilverDragonTears SilverDragonTears is offline
I am your Nemesis.
 
Join Date: Jun 2011
Posts: 1,113
Gender: Female
Credits: 110,789
SilverDragonTears is on a distinguished road
Default

I changed it to
Code:
$adopts->query('REPLACE INTO ' . ".constant('PREFIX')." . 'sort_adoptables (`user_id`, `adoptable_id`, `sorting_id`) 
									VALUES ("' . addslashes($userID) . '", "' . addslashes($aid) . '", "' . addslashes($orderID) . '")');

		
	}
and still not working. I pasted the wrong one!
__________________

Check out SilvaTales
Reply With Quote
  #18  
Old 04-10-2012, 01:26 AM
Hall of Famer's Avatar
Hall of Famer Hall of Famer is offline
Administrator, Lead Coder
 
Join Date: Dec 2008
Location: South Brunswick
Posts: 4,448
Gender: Male
Credits: 575,845
Hall of Famer is on a distinguished road
Default

Well the cookie definition has changed, use $_COOKIE['mysuid'] instead of $_COOKIE['auid']. Honestly the code you posted above should not even work in Mys v1.3.0 security release. I strongly recommend you not to use cookie superglobals to convey information, since I may end up encrypting cookies in future to improve security(so if a hacker steals your cookie, he still gets nothing out of it but a string that makes no sense). When this happens, you will not get anything out of it. Theres no way to decrypt by writing a PHP script.
__________________


Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site.
Reply With Quote
  #19  
Old 04-10-2012, 01:29 AM
SilverDragonTears's Avatar
SilverDragonTears SilverDragonTears is offline
I am your Nemesis.
 
Join Date: Jun 2011
Posts: 1,113
Gender: Female
Credits: 110,789
SilverDragonTears is on a distinguished road
Default

lol, Still not working
__________________

Check out SilvaTales
Reply With Quote
  #20  
Old 04-10-2012, 01:32 AM
Hall of Famer's Avatar
Hall of Famer Hall of Famer is offline
Administrator, Lead Coder
 
Join Date: Dec 2008
Location: South Brunswick
Posts: 4,448
Gender: Male
Credits: 575,845
Hall of Famer is on a distinguished road
Default

Well try to debug by echoing the $COOKIE['mysuid'] to the screen, see what it stores. Theres a chance I already encrypted uid in cookies, and if this happens you cannot hope to use cookies as information. Like I said before, its bad practice to use cookies to fetch information such as user id, username and password unless its used internally by the script to compare hashes.
__________________


Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site.
Reply With Quote
Reply

Thread Tools
Display Modes

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
New newbie joining in destrovel Newcomer Center 2 09-14-2014 11:18 AM
Shop Tables SilverDragonTears Questions and Supports 1 02-02-2013 03:26 PM
More fetching from tables help SilverDragonTears Questions and Supports 4 04-30-2012 03:00 PM
Tables StarGirl Questions and Supports 3 04-26-2012 02:57 PM
Joining Usergroups Cindykt Questions and Supports 1 08-19-2011 09:25 PM


All times are GMT -5. The time now is 07:39 PM.

Currently Active Users: 6594 (0 members and 6594 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