| Index
» Projects
» phpMyEdit
» Forum
» User query with ">" or "<" instea |
 |
marshal
Joined: 03 Aug 2004
Posts: 2
Posted: 2004-08-03 20:34
Back to top
Reply with quote
|
I have a form that has a date column. I want the users of the form to be able to select rows where the date is greater or less than some date. However, the phpMyEdit default for searches on a column is the LIKE operator.
Any ideas how to use ">", "<", or BETWEEN in column searches?.
PS. phpMyEdit rocks! With only a basic understanding of php and MySQL, I managed to put together a very nice little data entry application for some friends. Thanks to all the developers.
|
marshal
Joined: 03 Aug 2004
Posts: 2
Posted: 2004-08-05 14:30
Back to top
Reply with quote
|
| doug wrote: |
Did you find that when 'select' => 'N' you get to enter a start date (or end date) with the drop-down box that appears?
|
When I first read the docs, I didn't understand how the 'select' worked, but your example cleared it up for me. I also tried the other options, 'D' and 'M', to see how they work. 'D' gives a nice drop down list of all the unique values in the column; the user can select one to see only those rows. 'M' is similar; the user can select multiple values to match.
Thanks Doug. Much appreciated.
|
elmonty
Joined: 13 Mar 2005
Posts: 3
Posted: 2005-04-07 14:56
Back to top
Reply with quote
|
Again, the date format issue rears its ugly head. My users want to do a "greater than" query on a date field. However, because we want the date format to be "m/d/yyyy", the resulting query turns out like this:
IF((Expires IS NULL) OR (Expires="0000-00-00"),"",DATE_FORMAT(Expires, "*m/*d/*Y")) > '1/1/2005'
Needless to say, this does not produce correct results because it performs a string comparison instead of a date comparison.
How do I solve this problem?
|
elmonty
Joined: 13 Mar 2005
Posts: 3
Posted: 2005-04-07 16:03
Back to top
Reply with quote
|
Formatting and parsing should be done with PHP instead of MySQL because of it's greater power and flexibility. If we were to add two new field options, it would solve most of the problems:
'fromdb': assign a user-defined PHP function to this. The function's job is to take a MySQL field value and format it for display.
'todb': assign a user-defined PHP function that takes an edited (or query) value and formats it so that it is ready to insert into MySQL.
If these options are assigned, then phpMyEdit performs its default (current) operations on the field.
|
|
Post new topic
Reply to topic
|
|
|
|