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
  #1  
Old 10-27-2011, 02:54 PM
Slix's Avatar
Slix Slix is offline
Member
 
Join Date: Jun 2010
Posts: 14
Credits: 2,233
Slix
Default Loop inside loop?

So I'm trying to write a script where every few hours it gives certain adoptables a click. I have the loop working for giving the click, but I also want it to update the users table for the new "steps" as they're called. I can't get the second part to work... Any suggestions?

Thanks in advance!


Code:
$query = "SELECT * FROM ".$prefix."owned_adoptables WHERE tradestatus='PokeWalker'";
$result2 = mysql_query($query);
$num2 = mysql_num_rows($result2);




$article_title = "Ahuh.";
$article_content = "";


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

$aid=@mysql_result($result2,$i,"aid");
$type=@mysql_result($result2,$i,"type"); 
$name=@mysql_result($result2,$i,"name");
$totalclicks1=@mysql_result($result2,$i,"totalclicks");
$totalclicks = number_format($totalclicks1);
$currentlevel=@mysql_result($result2,$i,"currentlevel"); 
$usealternates=@mysql_result($result2,$i,"usealternates");
$tradestatus=@mysql_result($result2,$i,"tradestatus");
$isfrozen=@mysql_result($result2,$i,"isfrozen");
$owner=@mysql_result($result2,$i,"owner");
$gender=@mysql_result($result2,$i,"gender");
$original=@mysql_result($result2,$i,"original");
$obtained=@mysql_result($result2,$i,"obtained");
$happiness=@mysql_result($result2,$i,"happiness");


$ownerusername = $owner;

$query = "SELECT * FROM ".$prefix."users WHERE username='".$ownerusername."'";
$result3 = mysql_query($query);
$num3 = mysql_num_rows($result3);


$pokewalkersteps=@mysql_result($result3,$i,"pokewalkersteps");


$newpokewalkersteps = $pokewalkersteps + 1;

$query = "UPDATE ".$prefix."users SET pokewalkersteps='".$newpokewalkersteps."' WHERE username='".$ownerusername."'";
mysql_query($query);


$article_content = $article_content.$name." - ".$aid."<br>";

$newclicks = $totalclicks1 + 1;

//$query = "UPDATE ".$prefix."owned_adoptables SET totalclicks='".$newclicks."' WHERE aid='".$aid."'";
//mysql_query($query);


$article_content = $article_content.$ownerusername." - ".$newpokewalkersteps."<br>";

$i++;


}
__________________
Poliwager ~ Pokémon Forums ~ Adopt a Pokémon

Reply With Quote
Reply

Tags
clicks, loop, users


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
Mys v1.3.4 Index Page Mod (Use PHP inside Index!) Kyttias Mys v1.3.x Mods 1 01-19-2015 10:49 PM
Opinions and Suggestions (Security issue inside) nobackseat Feedback and Suggestions 13 02-07-2011 12:17 AM


All times are GMT -5. The time now is 06:15 AM.

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