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 06-05-2014, 01:49 PM
IntoRain's Avatar
IntoRain IntoRain is offline
Moderator
 
Join Date: Jul 2013
Location: Portugal
Posts: 461
Gender: Female
Credits: 23,410
IntoRain is on a distinguished road
Default

Okay a few things I think you are confusing.

1)
This:

public function setAdoptObedience(){
$query = "INSERT INTO adopts_owned_adoptables
(obedience)
WHERE aid = $this->aid;
VALUES
($obedience)";
$mysidia->db->exec($query);
}

Use $mysidia->db->insert("table_name_without_prefix",array("name_of _attribute" => $value_of_attribute,"another" => $more_values)) to insert new objects into tables

Use $mysidia->db->update("table_name_without_prefix",array("name_of _attribute" => $value_of_attribute,"another" => $more_values),"attribute = $value and anotherattribute = $value") to update values in the table. Your adoptables already exist, you just want to update their information. In OwnedAdoptables you don't create a new OwnedAdptable, you just get or set new information, by selecting something from the database or updating it.

2)
To get a random value use rand(min_value,max_value).

3)
Your setObedience function returns no value at all, so in adopt.php doing variable = setObedience() doesn't store anything.

4)
The new adopt is only added to the database after the line mysidia->db->insert("owned_adoptables",...). Before that line, he's an Adoptable, so the adopt->setObedience() function doesn't exist for an Adoptable, since you created it for an OwnedAdoptable.

5) In fact, in adopt.php the line mysidia->db->insert("owned_adoptables",...) creates the adopt, you can't use a query before the adopt actually existing on the table. You can just get a random variable before the insert and in the insert add the obedience value. Like:

PHP Code:
...
$adoptobedience rand(min_value,max_value);
$gender $adopt->getGender(); 
$mysidia->db->insert("owned_adoptables", array("aid" => NULL"type" => $adopt->getType(), "name" => $name"owner" => $mysidia->user->username"currentlevel" => 0"totalclicks" => 0"code" => $code"imageurl" => NULL"usealternates" => $alts"tradestatus" => 'fortrade'"isfrozen" => 'no'"gender" => $gender"lastbred" => 0"obedience" => $adoptobedience)); 
__________________


asp.net stole my soul.
Reply With Quote
Reply

Thread Tools
Display Modes

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


All times are GMT -5. The time now is 02:08 PM.

Currently Active Users: 2250 (0 members and 2250 guests)
Threads: 4,082, Posts: 32,047, 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