Topic: Calendar Query

well im tryin to make a calendar for punbb, witch will on the calendar page show how many posts made on a certon day, and on the view page will show thoes posts made that day, and i cant figure out how to go about doin that. could some one possibly help me.

Re: Calendar Query

well, learn php, if you dont already know it, then learn mysql, if you dont already know it.

im not sure, i havent spent much time on it, but look at the calendar functions in the php tutorial (the .chm from php.net)

Indocron
$theQuestion = (2*b) || !(2*b);

Re: Calendar Query

i know how to do it with a simple query but iv looked at punbbs querys and i dont understand it. and i dont know how id decode the topic start date to be able to see if is for that day.

Re: Calendar Query

I need to find out how to show just the post made on the selected day. if that helps any

Re: Calendar Query

well, it keeps the date in the database, so just run a query to get all posts that day and display them. should be simple (hopefully)

Indocron
$theQuestion = (2*b) || !(2*b);

Re: Calendar Query

Gizzmo, the posted column shows the date/time in epoch seconds.  You need to convert the date range to epoch seconds and then retrieve the posts/topics where "posted" is within that range.

try php.net/date to give you an idea of the functions...

Digital photography news, reviews, discussions and more!
http://www.shuttertalk.com

The online bible for all
http://www.publicbible.com

7

Re: Calendar Query

You want to count posts in every day, show it as calender?
and if click on day link will show links to posts in that day, as searching.

like yahoo groups, it's simple keep going and finish it smile.

If your people come crazy, you will not need to your mind any more.

8 (edited by zaher 2004-09-13 06:04)

Re: Calendar Query

"posted" field is "unsigned int" not timestamp
you cant make

where month(posted) = 1
group by dayofmonth(posted)

i try "cast" but not worked?

If your people come crazy, you will not need to your mind any more.

Re: Calendar Query

i got it to work, all i did was pull all info from the topics table and order it by posted, than convert the said date (at noon) to unix timestamp and minus the 2. than i would see if the number is between -43200 & 43200 and if soo it will show the topic.

i bet its alot of work for the SQL server on ever page load, but its the only way i could figure out.

Re: Calendar Query

eek!  can't  you put the range into the SQL query so that you don't extract all topics?  Just do the conversion to unix time before the query is performed, and then add it to the select statement.

ie. SELECT blah FROM blah WHERE posted > starttime AND posted < endtime

Digital photography news, reviews, discussions and more!
http://www.shuttertalk.com

The online bible for all
http://www.publicbible.com

Re: Calendar Query

This is an example of what i'm talking about -- I used this to display number of topics and posts in the last 24 hours at the bottom of the forum index.

$lastday = time() - (24 * 60 * 60);
$result = $db->query('SELECT COUNT(*) FROM '.$db->prefix.'topics WHERE posted > '.$lastday)

Just put another AND clause to limit it to a date range.

Digital photography news, reviews, discussions and more!
http://www.shuttertalk.com

The online bible for all
http://www.publicbible.com

12

Re: Calendar Query

I agree with "Cuteseal"
put range by month (some math to calc starttime and endtime) and grouped by day
"group by (posted / 86400)"

If your people come crazy, you will not need to your mind any more.

13

Re: Calendar Query

thats a good idea would save on sql server load right wouldnt have to work so hard

Re: Calendar Query

so you gonna make this a mod and release it? hint hint....

Indocron
$theQuestion = (2*b) || !(2*b);

15

Re: Calendar Query

yea, i might, i have a few things more i wana do to it, like set up a language pack and be able to see the count on the calendar page. thats gona be the tuff one, im stuck on that.

16

Re: Calendar Query

hey if the php code creats the month name do i have to put that in the lag pack or will it translate its self depnding on the php server?

Re: Calendar Query

youd think it would translate itself, depending on the server settings....

just to let you know, that means i have no clue wink

Indocron
$theQuestion = (2*b) || !(2*b);

18

Re: Calendar Query

i think it will too....well find out when someone tryes it on a different lang server

Re: Calendar Query

Gizzmo, can you create a calander, in which we can add birthday, anniversaries, and other important hints. and it should be unique.. only the particular user can view his/her calander.

something like peronalised..

God wisely designed the human body so that we can neither pat our own backs nor kick ourselves too easily

20

Re: Calendar Query

wow that will be hard to make, realy hard

21

Re: Calendar Query

Gizzmo,
   Welcome to real world of programming big_smile

If your people come crazy, you will not need to your mind any more.