Re: request
| From: | Peter Pistorius | Date: | Thu, 17 Apr 2003 14:06:35 +0000 |
| Subject: | Re: request | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-144285@lists.php.net to get a copy of this message | ||
Okay. This is how we are going to do it, it's a dirty hack, by a hack
non-the-less:
here are the names in my database:
id name
1 steve
2 john
3 mike
4 paul
5 george
6 bob
and the source:
<?php
mysql_connect('localhost','root', 'qwerty');
$res = mysql_query("SELECT name FROM adminsys.user");
$cnt = null;
# what am I looking for?
$search = 'e';
while (list($db_name) = mysql_fetch_row($res))
{
$cnt++;
if (strstr($db_name, $search))
{
echo "$cnt $db_name <br />";
}
}
?>
and the result of running this script:
1 steve
3 mike
5 george
Regards,
Peter "Pod" Pistorius
(Poor, unemployed, student in South Africa)
peterp@podbox.co.za