Mysidia Adoptables Support Forum

Mysidia Adoptables Support Forum (http://www.mysidiaadoptables.com/forum/index.php)
-   Questions and Supports (http://www.mysidiaadoptables.com/forum/forumdisplay.php?f=18)
-   -   How to replace this to work with new Mys (http://www.mysidiaadoptables.com/forum/showthread.php?t=3568)

SilverDragonTears 04-03-2012 07:57 PM

How to replace this to work with new Mys
 
Anyone know what to replace the query with to work with the new functions? I've tried things but nothing works.

PHP Code:

function getfamilymembers($aid$generation){
  
$familymember = array(array($aid));  
  for(
$i=0$i<$generation$i++){
    for(
$j=0$j<count($familymember[$i]); $j++){
      
$query "SELECT * FROM {$GLOBALS['prefix']}owned_adoptables WHERE aid = '{$familymember[$i][$j]}'";
      
$thisadopt mysql_fetch_array($result);
      
$familymember[$i+1][2*$j] = $thisadopt['mother'];
      
$familymember[$i+1][2*$j+1] = $thisadopt['father']; 
    }     
  }
  return 
$familymember;



Hall of Famer 04-04-2012 12:24 AM

Change this line:

PHP Code:

$thisadopt mysql_fetch_array($result); 

to the codes below:

PHP Code:

$stmt $GLOBALS['adopts']->query($query);
$row $stmt->fetch(PDO::FETCH_ASSOC); 


SilverDragonTears 04-04-2012 12:22 PM

Did that, now I'm getting:

Code:

Fatal error: Call to undefined function getcurrentimage() in /home/taleofdr/public_html/lineage.php on line 21
which is:
Code:

$familyinsert[0][0] = "<a href='levelup.php?id={$familymember[0][0]}'><img src='".getcurrentimage($familymember[0][0])."'/></a><br>";

Hall of Famer 04-04-2012 12:59 PM

Well that error has nothing to do with the function getfamilymember() script itself, and its simple enough to fix. I trust you will have no problem figuring it out on your own, give a try and lemme know only if you still cant find out cause of this error at the end of the day.

SilverDragonTears 04-04-2012 01:33 PM

I've been fiddling with it for three days now :( Usually I can figure these things out but not this one.
It's clearly the new functions thing. It works fine on my SA site.

Hall of Famer 04-04-2012 03:19 PM

Well just add the below codes to the beginning of your script file:

PHP Code:

include("functions/functions_adopts.php"); 

The function getcurrentimage() has been moved to the file functions_adopts.php. I split the original large functions.php file into five pieces for Mys v1.3.0.

SilverDragonTears 04-04-2012 04:37 PM

Well I managed to get the page to show without errors... I didn't know how to properly change this:

Code:

      $adoptexist = mysql_num_rows($result);
So I removed it. The parents don't show up though :/

Edit: Lol... my wisdom tooth hurts and is making my brain stupid.. I fixed it :p

SilverDragonTears 04-04-2012 05:49 PM

One more thing... the names aren't showing up?

Code:

function getfamilynames($familymember, $generation){
  $familyname = array(array());
  for($i=0; $i<=$generation; $i++){
    for($j=0; $j<count($familymember[$i]); $j++){
      $query = "SELECT * FROM {$GLOBALS['prefix']}owned_adoptables WHERE aid = '{$familymember[$i][$j]}'";
      $stmt = $GLOBALS['adopts']->query($query);
$adoptexist = $stmt->fetch(PDO::FETCH_ASSOC);
      if($adoptexist == 0) $familyname[$i][$j] = "<br>";
      else $familyname[$i][$j] = $thisadopt['name'];
    }
  }
  return $familyname; 
}


Hall of Famer 04-04-2012 06:08 PM

Well, replace the line below:

PHP Code:

$adoptexist $stmt->fetch(PDO::FETCH_ASSOC);        
if(
$adoptexist == 0$familyname[$i][$j] = "<br>"

by the correct one:

PHP Code:

$thisadopt $stmt->fetch(PDO::FETCH_ASSOC); 
if(!
is_object($thisadopt)) $familyname[$i][$j] = "<br>"


SilverDragonTears 04-04-2012 06:12 PM

That didn't work but I left out a part... here is the original

Code:

function getfamilynames($familymember, $generation){
  $familyname = array(array());
  for($i=0; $i<=$generation; $i++){
    for($j=0; $j<count($familymember[$i]); $j++){
      $result = mysql_query("SELECT * FROM {$GLOBALS['prefix']}owned_adoptables WHERE aid = '{$familymember[$i][$j]}'");
      $thisadopt = mysql_fetch_array($result);
      $adoptexist = mysql_num_rows($result);
      if($adoptexist == 0) $familyname[$i][$j] = "<br>";
      else $familyname[$i][$j] = $thisadopt['name'];
    }
  }
  return $familyname; 
}



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

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.