homepage Welcome to WebmasterWorld Guest from 54.161.246.212
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Fetching data every monday & thursday
chrissim

5+ Year Member



 
Msg#: 4152920 posted 1:48 pm on Jun 15, 2010 (gmt 0)

hi,

is there any way how to fetch data every monday and thursday by calling the query below or how do you apply the coding. Please help ...

Thanks


$data = mysql_query("SELECT * FROM Bill")

 

coopster

WebmasterWorld Administrator coopster us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 4152920 posted 1:51 pm on Jun 15, 2010 (gmt 0)

Do you mean the data in the "Bill" table has a TIMESTAMP and you want only those records returned with the TIMESTAMP of Monday and Thursday? Or do you only want to run the query itself on Monday and Thursday?

chrissim

5+ Year Member



 
Msg#: 4152920 posted 1:56 pm on Jun 15, 2010 (gmt 0)

hi coopster

yes i need those records returned with the Timestamp of every monday and thursday. Hope it helps

coopster

WebmasterWorld Administrator coopster us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 4152920 posted 2:01 pm on Jun 15, 2010 (gmt 0)

Have a look at the MySQL DAYOFWEEK [dev.mysql.com] function on the Date and Time Functions manual page. That should get you started. If you have difficulty constructing the rest of the query or run into other problems just post back here again.

chrissim

5+ Year Member



 
Msg#: 4152920 posted 2:33 pm on Jun 15, 2010 (gmt 0)

hi,

i'm having difficuty constructing the query and completely new to php and appreciate if you could show me how to do it right.
Thanks

coopster

WebmasterWorld Administrator coopster us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 4152920 posted 3:15 pm on Jun 15, 2010 (gmt 0)

$sql = "SELECT * FROM Bill WHERE DAYOFWEEK(yourDateColumn) IN (2,5)";

Sunday is 1, Monday is 2, etc. according to the manual page.

chrissim

5+ Year Member



 
Msg#: 4152920 posted 12:54 am on Jun 17, 2010 (gmt 0)

hi,

The sql query is not working for me pretty well. i'm facing problem having the emty data retrieved between 15-06-2010 and 16-06-2010 if today is not monday and thursday. i like my result to output only on my specific date if today are monday thursday otherwise the result should remained the same from last output
Can you guys help me out please?

eg my mysql table with column as item and date. Only monday and thursday recorded

1. item1 14-06-2010(monday)
2. item2 17-06-2010(thursday)
3. item3 21-06-2010(monday)

Thanks

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved