how to update a data everyday using php and mysql

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
amitdubey2
Forum Commoner
Posts: 48
Joined: Tue Apr 13, 2010 10:13 pm

how to update a data everyday using php and mysql

Post by amitdubey2 »

Hello everyone,
I am new to php and mysql,,,i stuck with a problem and need help.

The problem is that i am working on a website for horoscope.Where i want to make a admin account who can submit data about sunshines for any date ( for example on 14th april he can submit data for 15,16,17,....)
But the user will only see the data for the current date.(like if today is 14th april ,he will see the sunshine data for 14th only)and on 15th april data will automatically update and now on 15th april user can see only for 15th...like this.
so how to solve this and wht should b the logic and syntax for this..any idea??. :?: :?: :idea:



Regards
Amit
roders
Forum Commoner
Posts: 68
Joined: Tue Oct 20, 2009 9:29 am

Re: how to update a data everyday using php and mysql

Post by roders »

how about if you put the currentdate in you sql query something like this

Code: Select all

$query="select * from horoscope_table where date_format(date_field,'%Y-%m-%d')=current_date()";
change to match your tablename and date field
amitdubey2
Forum Commoner
Posts: 48
Joined: Tue Apr 13, 2010 10:13 pm

Re: how to update a data everyday using php and mysql

Post by amitdubey2 »

got the trick for that..

i have inserted a calender from which i will get the date of submit, then i changed its format so that it was similar to the mysql date format.After that i retreived that date on the other page and compare with the current date , by this it will show the records for current day only....!
:D :) :crazy:

if you have some problem to understand my logic ..feel free to mail me on - amitdubey2@gmail.com


Amit dubey
india
Post Reply