I need a MySQL select statement as part of a PHP script. I want to find
rows where a certain column either starts with or equals a user-supplied
string. The string will be 1 or more characters in length.
The sending page allows the user to choose which search criteria he
wants, so this (and many other) pieces of the select statement may or
may not be present. The statement always starts with
SELECT * from logdata where driver = '$_COOKIE[username]'
If the user has selected them and supplied the proper data for a search,
other elements will be added to the query string. For example, it may
look like
SELECT * from logdata where driver = '$_COOKIE[username]' AND amount >=
$_POST[txtLowAmount] AND amount <= $_POST[txtHighAmount] AND restaurant
regexp???
I'm not even sure if that is where a regexp belongs or if that is how it
should be used.
Ultimately, I would prefer it be non case sensitive.
Here are some examples of what I want:
If the user string is "CHIL"
Chili's true
Charlie's false
CHIL true
ch false
Thank you in advance
Jeff Sandler
rows where a certain column either starts with or equals a user-supplied
string. The string will be 1 or more characters in length.
The sending page allows the user to choose which search criteria he
wants, so this (and many other) pieces of the select statement may or
may not be present. The statement always starts with
SELECT * from logdata where driver = '$_COOKIE[username]'
If the user has selected them and supplied the proper data for a search,
other elements will be added to the query string. For example, it may
look like
SELECT * from logdata where driver = '$_COOKIE[username]' AND amount >=
$_POST[txtLowAmount] AND amount <= $_POST[txtHighAmount] AND restaurant
regexp???
I'm not even sure if that is where a regexp belongs or if that is how it
should be used.
Ultimately, I would prefer it be non case sensitive.
Here are some examples of what I want:
If the user string is "CHIL"
Chili's true
Charlie's false
CHIL true
ch false
Thank you in advance
Jeff Sandler
Comment