You are here: Re: PHP Date Search Question « PHP Programming Language « IT news, forums, messages
Re: PHP Date Search Question

Posted by Dave on 06/07/05 04:44

Greg (greg@basssax.com) decided we needed to hear...
> I retyped the code, therefore the typo's. Thanks to both of you for
> your suggestions. I changed the date columns in the db and that did the
> trick. All is good now. I've set all of the date fields to
> automatically fill in so the employees will not have to type them. I'm
> new to php so I don't understand "validating vars" and "testing
> mysql_num_rows()" yet. Got time for the readers digest version on how
> to do this or a suggestion on where to find a good tutorial?
>
> Thanks for your help,
>
> Greg

Glad its working for you now.

By validating vars, I meant checking (for example) that a variable you
expect to contain a valid date, actually does contain a valid date and
not some other nonesense value that would break your code. You can do
this pretty much any way you like with if statements, string and number
functions, date functions etc. For the valid date example, you might
start by checking out the strtotime function which tries to parse a
date and lets you know if it could or not -
http://ca.php.net/manual/en/function.strtotime.php

mysql_num_rows() returns the number of rows selected in the most
recently executed query. Your testing of $result didn't accomplish
much because by that point in the code your query had already worked
(your program dies if it did not). Because you know the query worked,
what you really need to know at this point is were any rows returned
or not. Thats where mysql_num_rows() comes in.

HTH
--
Dave <dave@REMOVEbundook.com>
(Remove REMOVE for email address)

 

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

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