Mysidia Adoptables Support Forum  

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

Notices

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #3  
Old 03-26-2009, 03:13 PM
kisazeky kisazeky is offline
Member
 
Join Date: Mar 2009
Posts: 44
Credits: 28,333
kisazeky
Default RE: How to "buy" adoptables?

Quote:
Originally Posted by BMR777
You would have to get the info from both tables and store in variables. Then check if the money variable is greater than or equal to the currency in the users table. If it is, then deduct the currency and do the transaction. :)
Yeah I tried to do that, but I can't get the code to replace the "name the adoptable" article content with "you can't afford this adoptable" if they don't have enough money.

It takes me to the name the adoptable page even if I in fact have less money than the adoptable cost.

This is the code I'm using:

PHP Code:
}
else if (
$isloggedin == "yes" and $aID != ""){
//A Logged In user is adopting a new creature

//Check first that the creature does in fact exist...
//Get adoptable info
$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++;
}
//Get how much money you have
$query "SELECT * FROM `users` WHERE `username` = '$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>.";
}

//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 {
//Creature is valid, let's adopt the sucker...
//Procedure for giving the user's adoptable a name

    
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 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{ 
Here are what the tables being referenced look like:





What is the problem?
Reply With Quote
 


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
Creating a "Faction" for adoptables/owned adoptables Vaporman87 Questions and Supports 1 03-04-2014 03:38 PM
Choosing Adoptables Type [EASY ADOPTABLES SCRIPT ONLY] Ashje Addons/Mods Graveyard 2 05-24-2009 03:17 AM


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

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