View Single Post
  #5  
Old 03-26-2009, 09:41 PM
kisazeky kisazeky is offline
Member
 
Join Date: Mar 2009
Posts: 44
Credits: 19,820
kisazeky
Default RE: How to "buy" adoptables?

Nope, it's still not working.

PHP Code:
//A Logged In user is adopting a new creature

//Check first that the creature does in fact exist...
$query "SELECT * FROM adoptables WHERE uid = '$aID'";
$result = @mysql_query($query);
$num = @mysql_numrows($result);

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

$newID=@mysql_result($result,$i,"uid");
$name=@mysql_result($result,$i,"name");
$imageurl=@mysql_result($result,$i,"imageurl");
$cost=@mysql_result($result,$i,"description");

$i++;
}

$query "SELECT * FROM users WHERE uid = '$username'";
$result = @mysql_query($query);
$num = @mysql_numrows($result);

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

$money=@mysql_result($result,$i,"money");

$i++;
}

if(
$newID != $aID){
$stop 1;
$article_title "Error";
$article_date date('Y-m-d');
$article_content "This Digimon is not available for adoption. <a href='adopt.php'>Go back</a>.";
}

else {
//Creature is valid, let's adopt the sucker...
//Procedure for giving the user's adoptable a name

//Can the user afford the adoptable?
if($money $cost){
$article_title "Oops";
$article_date date('Y-m-d');
$article_content "You can't afford this Digimon.";
}

else {
    if(
$cname == "" and $flag !=12){
    
$article_title "Adopt ".$name;
    
$article_date date('Y-m-d');
    
$article_content "<p align='left'>You are about to adopt ".$name.". </p>
<p align='left'><img src='"
.$imageurl."' border='0'></a> </p>
<p align='left'>You may give "
.$money." your new Digimon a nickname.  His or her name can contain letters, numbers and spaces.</p>
<form name='form1' method='get' action='adopt.php'>
  <p>
    <input name='aID' type='hidden' id='aID' value = '"
.$aID."'>
    Nickname 
    <input name='cname' type='text' id='cname' size=20 maxlength='20'>
    <input name='flag' type='hidden' id='flag' value = '12'>
  </p>
  <p>
    <input type='submit' name='Submit' value='Adopt!'>
</p>
</form>"
;
    }
    }
    }
    }

    else{ 
Edit: Alright, I totally ripped up your original adopt code and made it do something similar to managing your adoptables. That is, using
PHP Code:
adopt3.php?aID=aID&action=adopt 
instead of doing it all on the adopt page. Basically the adopt crap happens on adopt3.php instead of adopt.php.
Reply With Quote