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
  #11  
Old 08-10-2011, 07:30 PM
SilverDragonTears's Avatar
SilverDragonTears SilverDragonTears is offline
I am your Nemesis.
 
Join Date: Jun 2011
Posts: 1,113
Gender: Female
Credits: 85,245
SilverDragonTears is on a distinguished road
Default

ooo I think i got it...

PHP Code:

if($lastbred == '') {
    
$article_content .= '';

else if(
$lastbred == '0') {
    
$article_content .= '';
} else {
    
$article_content .= 'Last bred: '.date('Y-m-d'$lastbred).'<br>
           '
.date('Y-m-d'time()). '<br>';


But the adults that have bred are still printing out two dates so remove the second date echo?
__________________

Check out SilvaTales
Reply With Quote
  #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: 5,237
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
  #13  
Old 08-10-2011, 07:58 PM
SilverDragonTears's Avatar
SilverDragonTears SilverDragonTears is offline
I am your Nemesis.
 
Join Date: Jun 2011
Posts: 1,113
Gender: Female
Credits: 85,245
SilverDragonTears is on a distinguished road
Default

LoL I kept posting so I think you missed mine... I think I got it =p
This:
PHP Code:

if($lastbred == '') {
    
$article_content .= '';

else if(
$lastbred == '0') {
    
$article_content .= '';
} else {
    
$article_content .= 'Last bred: '.date('Y-m-d'$lastbred).'<br>';


Seems to be working well! Wouldn't have been able to do it without your help though =) Thank you.

This is completely unrelated to this issue...
But I added in Date Caught/Bred and the ones that were already caught or bred before this was added have no dates. Is there an easy way to insert into the database a default date for those who don't have one?
__________________

Check out SilvaTales
Reply With Quote
  #14  
Old 08-10-2011, 08:47 PM
Chibi_Chicken Chibi_Chicken is offline
Niwatori Kami
 
Join Date: Jun 2011
Posts: 63
Gender: Unknown/Other
Credits: 5,237
Chibi_Chicken is on a distinguished road
Default

You are welcome. :)

you can run something like
UPDATE table SET Date Caught/Bred = '0' WHERE Date Caught/Bred = ''
Reply With Quote
  #15  
Old 08-10-2011, 08:53 PM
SilverDragonTears's Avatar
SilverDragonTears SilverDragonTears is offline
I am your Nemesis.
 
Join Date: Jun 2011
Posts: 1,113
Gender: Female
Credits: 85,245
SilverDragonTears is on a distinguished road
Default

do I do that in the phpadmin panel?
__________________

Check out SilvaTales
Reply With Quote
  #16  
Old 08-10-2011, 08:57 PM
SilverDragonTears's Avatar
SilverDragonTears SilverDragonTears is offline
I am your Nemesis.
 
Join Date: Jun 2011
Posts: 1,113
Gender: Female
Credits: 85,245
SilverDragonTears is on a distinguished road
Default

uh oh... i did this

UPDATE `adopts_owned_adoptables` SET `date`=2011-08-10 WHERE date=0000-00-00

and it put 1993 in there LOL

Shoot I keep double posting =( Sorry guys!!

Got it =) It was
UPDATE adopts_owned_adoptables
SET date='2011-08-10'
WHERE date='1993'
__________________

Check out SilvaTales

Last edited by SilverDragonTears; 08-10-2011 at 09:11 PM.
Reply With Quote
  #17  
Old 08-11-2011, 01:14 AM
Chibi_Chicken Chibi_Chicken is offline
Niwatori Kami
 
Join Date: Jun 2011
Posts: 63
Gender: Unknown/Other
Credits: 5,237
Chibi_Chicken is on a distinguished road
Default

that is cool that you got it working. :)
question in your DB what type is date is it a varchar or date format, and when comparing dates in php do you have to do anything special?
Reply With Quote
  #18  
Old 08-11-2011, 01:38 AM
SilverDragonTears's Avatar
SilverDragonTears SilverDragonTears is offline
I am your Nemesis.
 
Join Date: Jun 2011
Posts: 1,113
Gender: Female
Credits: 85,245
SilverDragonTears is on a distinguished road
Default

it's varchar... and not sure I understand the second question
__________________

Check out SilvaTales
Reply With Quote
  #19  
Old 08-11-2011, 02:58 AM
Chibi_Chicken Chibi_Chicken is offline
Niwatori Kami
 
Join Date: Jun 2011
Posts: 63
Gender: Unknown/Other
Credits: 5,237
Chibi_Chicken is on a distinguished road
Default

well I just wonder what would happen when you compare $date with $currentdate

like $date = '2010-08-10'
$currentdate = '2011-08-11'

if $date < $currentdate
"your adopt is able to do something"

I guess what I am confused about is how comparing strings work, because php doesnt know that tho two variables are dates, or at least I dont think it knows.
I will have to look in to it.
Reply With Quote
Reply


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 06:56 PM.

Currently Active Users: 307 (0 members and 307 guests)
Threads: 4,080, Posts: 32,024, 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 - 2024, vBulletin Solutions Inc.
vBCommerce I v2.0.0 Gold ©2010, PixelFX Studios
vBCredits I v2.0.0 Gold ©2010, PixelFX Studios
Emoticons by darkmoon3636