View Single Post
  #2  
Old 05-04-2014, 10:19 AM
IntoRain's Avatar
IntoRain IntoRain is offline
Moderator
 
Join Date: Jul 2013
Location: Portugal
Posts: 461
Gender: Female
Credits: 19,595
IntoRain is on a distinguished road
Default

PHP Code:
if($this->adopt->hasVoter($mysidia->user$date)){
            
// The user has leveled up this adoptable today, show error message
            
$message 'Name:' $adoptablename 'Species:' $species 'Gender:' $gender 'Total Clicks:' $totalclicks 'Trade Status:' $tradestatus;
            
$message = ($mysidia->user instanceof Member)?$mysidia->lang->already_leveled_member:$mysidia->lang->already_leveled_guest;
            
$document->setTitle($mysidia->lang->already_leveled_title);
            
$document->addLangvar($message);
        } 
Saying message equals something and then message equals something else overwrites the previous value of message. Basically you are saying message = 1; and then message = 2;
I don't quite remember the appending operator, but you can do this:

$message = "Name: {$adoptablename}<br>
Species: {$species}<br>
Gender: {$gender}<br>
Total Clicks: {$totalclicks}<br>
Trade Status: {$tradestatus}<br>";
$message = $message .= (($mysidia->user instanceof Member)?$mysidia->lang->already_leveled_member:$mysidia->lang->already_leveled_guest);

PHP Code:
        $gender $mysidia -> db -> select ("owned_adoptables", array("gender"), "aid='{$adopt->aid}'") -> fetchColumn();
        
$adoptablename $mysidia -> db -> select ("owned_adoptables", array("name"), "aid='{$adopt->aid}'") -> fetchColumn();
        
$species $mysidia -> db -> select ("owned_adoptables", array("type"), "aid='{$adopt->aid}'") -> fetchColumn();
        
$totalclicks $mysidia -> db -> select ("owned_adoptables", array("name"), "aid='{$adopt->aid}'") -> fetchColumn();
        
$tradestatus $mysidia -> db -> select ("owned_adoptables", array("tradestatus"), "aid='{$adopt->aid}'") -> fetchColumn(); 
Also you don't need to do so many database queries. You already have the adoptable as a private variable, it's an object that has all the information you need about it, go to class_ownedadoptable.php to check which functions you can use to get the values. That way you only do one database access, and not 5 or 6. For example to get the gender $this->adopt->getGender() and the tradestatus $this->adopt->getTradeStatus();
__________________


asp.net stole my soul.
Reply With Quote