Hello everyone,
Can anyone help me find a php script (with mysql) that will allow me to create a dynamic table on a page with its content being a different text (like a devotion or quote) every day of the year? I do not need random text displayed but a text which is date dependent. For ex. one quote would be assigned to one and only one date, etc. (365 quotes). I have been looking for weeks now, even months, without any success. It would be a great help. The text will not be in English, so a link to an English site will not work. It has to be created from scretch. I just need an idea.....
Thank you all very much
Felix
PHP/MySql...dynamic text based on day of year?? Help!
If it were not for the fact that I am busy with the code for my own site, I could probably write one for you. For now, though, take a look at HotScripts.com and PHP Resource. Good luck in your search!
Edit: Sorry, I did not read read your entire post, so the above links may not work. PM me, though, and I'll see if we can work something out!
PHP/MySql...dynamic text based on day of year?? Help!
No problem.
First, set up a table with two fields, one of integers range 1 - 366, the other text fields with the text you want to use.
Then, using the SQL command "DAYOFYEAR()", you can write
SELECT {textfield} FROM {tablename} WHERE {intfield} = DAYOFYEAR(NOW());
which should return what you want.
Note that if there's a leap year, there are 366 days in the year... which also means that the quotes will be one day ahead of themselves from March onwards (day #60 in 2003 is the 1st March, but the 29th Feb in 2004)
This could be solved by using two references.
Have a table with two integer columns, one range 1-12, the other 1-31. Then set up the pairs - so 1-1 thru 1-31, 2-1 thru 2-29, etc where the first number references the month, and the second the day of the month. Then the SQL would be:
SELECT {textfield} FROM {tablename} WHERE {dayfield} = DAYOFMONTH((NOW()) AND {monthfield} = MONTH(NOW());
Hope that makes some sense! I know that's the SQL side, I'm assuming a knowledge of simple PHP...