RE: [PHP] MySQL help
| From: | Jonathan Sharp | Date: | Sat, 16 Dec 2000 00:57:07 +0000 |
| Subject: | RE: [PHP] MySQL help | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-30629@lists.php.net to get a copy of this message | ||
Try using the LIKE keyword...so...
$alpha_temp = substr($companyname, 0, 1);
$query = "SELECT * FROM $mysql_table_member_list WHERE COMPANY LIKE
\"$alpha_temp%\""
This would search and match all records where if $companyname = 'Bob's ski
club' any company that starts with a 'B'. I'm not sure on the case
sensitiveness of it... the % indicates a wildcard...
-sharpie!
-----Original Message-----
From: Marc Davenport [mailto:md261897@oak.cats.ohiou.edu]
Sent: Friday, December 15, 2000 4:30 PM
To: php-general@lists.php.net
Subject: [PHP] MySQL help
I'm trying to query a mysql database and have it only return values that
start with a certain letter.
my current query setup is this
$alpha_temp= $alpha . '*';
$query="SELECT * FROM $mysql_table_member_list WHERE COMPANY='$alpha_temp'
ORDER BY COMPANY";
$alpha is just a single character, ie 'a'
$alpha_temp was an attempt at using wild cards.
Does anyone understand me?
can anyone help?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net