Re: PHP Date Search Question



Greg (greg@xxxxxxxxxxx) 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@xxxxxxxxxxxxxxxxx>
(Remove REMOVE for email address)
.



Relevant Pages

  • RE: Incorecctly passing Date Parameter
    ... "Greg P" wrote: ... adParamInput, 10, dteWeek - 7) ... I am passing a parameter to access throught a command object. ... passed with out any issues to the same query. ...
    (microsoft.public.data.ado)
  • Re: What do you do when ListView.Items.Clear() doesnt clear??
    ... will find my query the second on the list, Mouse Events in an mdi project", ... > managed newsgroups. ... >> guaranteed response to technical queeries within 2 business days all I ...
    (microsoft.public.dotnet.languages.vb)
  • Re: linking two tables
    ... Greg wrote: ... Thank you for your response. ... I'm getting "Query is too complex" when creating TableX_Roll and Table_Y_Roll as i have 130 columns across ... Look up the term normalization. ...
    (microsoft.public.access.gettingstarted)
  • Re: SQL wont work
    ... Greg. ... Especially Ray Porter who eventually solved ... I have a MySQL database running on a Linux server and wanting to access ... code for the query. ...
    (comp.lang.pascal.delphi.databases)
  • Re: [PATCH] trivial fix for 2.6.11 raid6 compilation on ppc w/ Altivec
    ... I've fixed up the patch and applied it to a local tree that I've set ... > My suggestion would be one of two alternatives: ... This is closer to what I suggested to Greg (although I like your name ... send the line "unsubscribe linux-kernel" in ...
    (Linux-Kernel)