You are here: Re: simple events calendar using mysql « PHP Programming Language « IT news, forums, messages
Re: simple events calendar using mysql

Posted by Shelly on 11/01/07 16:20

jsd219 wrote:
> On Oct 31, 12:10 pm, "Shelly" <sheldonlg.n...@asap-consult.com> wrote:
>> jsd219 wrote:
>>> My appologies, i know how to do the query but i do not know how to
>>> tell the code to display the title and a link to a trip that matches
>>> the date. in other words where in the code below do i say ok, now
>>> that the calendar is displayed, if 10/31/2007 has a trip in the
>>> database
>>
>> You don't! What I mean by that it is not "now that the calendar is
>> displayed,". You have to put it in AS you are building your display!
>>
>> In other words, when you do your query, have it ordered by date
>> (ORDER BY the_date_field). Then build an array with all those rows.
>> Now, as you are going about building the display of your calendar,
>> check the date against the next one in the array. If it matches,
>> then do an
>>
>> echo 'value="' . $whatever_info_you_want_to_appear_here . '"';
>> (that last was single-double-single quotes).
>>
>> and increment your position in the array so that the next time you
>> check the date it will be the next one in the array. (Of course,
>> stop all this checking once you have done all the elements in the
>> array so that you are not going to get an out-of-bounds problem).
>>
>> Do you understand now?
>>
>> Shelly
>
> Please forgive my ignorance but i can not wrap my head around this. is
> what you are saying; query everything from the table and order it by
> date? i don't understand the . $id part.

Yes, that is exactly what I am saying. SQL will do that work for you and
all you need do is add the ORDER BY clause. Since you cut where I said
something about $id, I cannot help you other that to guess at what I said.
I guess it was in building a query statement and I had a where clause of
some field = something. Since the something would depend upon the value of
a variable, I put that in. The dot operator is the append operator in PHP.
Example:

$foo = "jsd";
echo "Hello " . $foo;

will output
Hello jsd

I suggest you do a little reading of the manual (www.php.net) or a tutorial
www.w3schools.com for PHP and SQL.

Shelly

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация