PHP Gurus,
        I have a database of events which happen on various dates. I've
set up a query to select all the dates within the current month. I've
got a calendar which shows one month at a time, as a table, on which to
display the relevant dates as links.
        My problem is that I can't figure out how to compare the results
of the query to the dates on the calendar so that they display on the
right dates.
        I thought I should put those date in an array and then on each
date, search that array for a matching date, and if it's found, then
display a link on that date. But my first obstacle was getting the
results of my query into an array.
        I first thought I could just use mysql_fetch_array(), but I am
obviously mistaken. According to php.net, that will make an array out of
the columns in the currently selected row. But I want to make an array
out of *all* the rows I have. Each row has only one entry, the date.
        I'm looking through all the mysql_* commands that are listed on
the left side of the page, and I don't see any commands that do that.
Surely this kind of action is common enough to merit having it's own
command...?
        As I read further, I wonder if my plan is flawed. I thought
mysql_data_seek would search the array based on my criteria, and then
return true or false. But what it says on php.net is very confusing for
me, so I have to admit I'm not sure what it does at all.

        I guess what I really am asking is, what is the most efficient
way for me to compare the dates on the calendar with the dates in my
database and display matches as links.
        I mean, I could put my mysql_query command in the while loop
that renders the calendar, and search for matching dates that way. But
that means searching the whole database table roughly 30 times each time
the page is accessed, and that can't be right. I'm sure this is better
handled with arrays, but I can't quite figure out the logic and the
commands.
        Can anyone help me out with this?

-- 
Cheers!
Dave G
[EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to