Thread: grr Last Bred
View Single Post
  #12  
Old 08-10-2011, 07:46 PM
Chibi_Chicken Chibi_Chicken is offline
Niwatori Kami
 
Join Date: Jun 2011
Posts: 63
Gender: Unknown/Other
Credits: 7,422
Chibi_Chicken is on a distinguished road
Default

$lastbred will need to be assigned a value. this value is going to come from the DB owned_adoptables lastbred column. So I am not sure where you are putting this but one way you can do it is.

PHP Code:
//you will need to supply the $id of the adoptable
$result runquery("SELECT * FROM ".$prefix."owned_adoptables WHERE aid = '$id'") ;
$lastbred = @mysql_result($result,0,'lastbred');
//now display the results
if($lastbred == '') {
    
$article_content .= '';
} else {
    
$article_content .= 'Last bred: '.date('Y-m-d'$lastbred).'<br>';
    
//i took out the second one unless you wanted to show the current day.

Their is a couple of problems with this. if the script is looping $result and you run this it will break the code, second this is a waste of resources if you all ready have the information you need from another $result you dont need to run another sql request. It will slow the site down.

I hope I am explaining this clearly If you want, what php page are you trying to add this in to, I can test it out latter when I am at work and see if I can make better sense of it.
ATM I am kinda of distracted with Terraria ^.^;
Reply With Quote