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)
-   -   Influence (http://www.mysidiaadoptables.com/forum/showthread.php?t=2524)

SilverDragonTears 11-11-2011 11:49 PM

Influence
 
So I thought my influence script was working but now that I've released it, it isn't functioning properly. When $lastinfluence is inserted, it inserts into ALL the adopts and not just the adopt doing the influence.

HELP!
PHP Code:

else if($act == "influence"){


if(
is_numeric($id)){

// Now we see if the adoptable actually exists...

$query "SELECT * FROM ".$prefix."owned_adoptables WHERE owner='$loggedinname' and aid='$id'";
$result runquery($query);
$num mysql_numrows($result);

//Loop out code
$i=0;
while (
$i 1) {

$aid=@mysql_result($result,$i,"aid"); //The adoptable's ID
$currentlevel=@mysql_result($result,$i,"currentlevel");
$type=@mysql_result($result,$i,"type");
$name=@mysql_result($result,$i,"name");
$totalclicks=@mysql_result($result,$i,"totalclicks");
$isfrozen=@mysql_result($result,$i,"isfrozen");
$lastinfluence=@mysql_result($result,$i,"lastinfluence");

$i++;
}

if(
$aid == $id){


$time time();
$image getcurrentimage($id); // Get the image for the adopt...

if($more == ""){

$article_title "Allow an adopt to be influenced female by ".stripslashes($name);
$article_content "<center><img src='".$image."'><br>"
$lastweek time() - ((grabanysetting('breedinginterval')) * 24 60 60);

if(
$lastinfluence >= '$lastweek'){
$article_content .= "You must wait one week before influencing.<br>";
}else{
$article_content .= "Select an Adoptable<br>";
       
$result runquery("SELECT * FROM {$prefix}owned_adoptables WHERE owner ='{$loggedinname}' and currentlevel <=3 and isfrozen = 'no'");
       while(
$row mysql_fetch_array($result)){
         
$article_content .= " <img src='http://silvadopts.com/get/".$row['aid'].".gif'> {$row['aid']} {$row['name']} <a href='myadopts.php?act=influence&id=".$row['aid']."&more=confirm'>Influence</a><br>";
       
}


       
}

}
else if(
$more == "confirm"){

// Actually run the execution

runquery("UPDATE ".$prefix."owned_adoptables SET gender='f', usealternates='yes' WHERE aid='".$id."'");
runquery("UPDATE ".$prefix."owned_adoptables SET lastinfluence = '$time' WHERE aid='$id'");

$article_title $lang_influence_title_complete;
$article_content $lang_influence_complete;

$article_content $aid." was influenced successfully!";
}



mapleblade 11-12-2011 02:53 AM

try changing
PHP Code:


runquery
("UPDATE ".$prefix."owned_adoptables SET gender='f', usealternates='yes' WHERE aid='".$id."'");
runquery("UPDATE ".$prefix."owned_adoptables SET lastinfluence = '$time' WHERE aid='$id'"); 

into
PHP Code:


runquery
("UPDATE ".$prefix."owned_adoptables SET gender='f', usealternates='yes' WHERE aid='".$aid."'");
runquery("UPDATE ".$prefix."owned_adoptables SET lastinfluence = '$time' WHERE aid='".$aid."'"); 


SilverDragonTears 11-12-2011 11:57 AM

I've tried that :/

Hall of Famer 11-12-2011 02:46 PM

umm are you sure this is all you got for the influence script? It is technically impossible to have influence inserting into all adoptables unless you have a loop that executes erroneously. I do not see such a loop from your codes above.

SilverDragonTears 11-12-2011 03:13 PM

I don't want it to go into all the adoptables. Just the one that is doing the influencing.

SilverDragonTears 11-13-2011 06:02 PM

Halp! :displeased:


All times are GMT -5. The time now is 01:43 AM.

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