Searching a MySQL database?
| From: | James, Yz | Date: | Sun, 14 Jan 2001 21:57:45 +0000 |
| Subject: | Searching a MySQL database? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-34503@lists.php.net to get a copy of this message | ||
Can anyone tell me what I would use to query a MySQL database in a search?
If the search field, was for example, a variable like "town", would the
results page use something like this? :
$sql = " SELECT * FROM table_name
WHERE towns = \"$town\" ";
I remember seeing someone post something like this:
$sql = " SELECT * FROM table_name
WHERE towns LIKE \"$town\" ";
so if the search word is not EXACTLY like a row in the database, it may
return results to partial words.
Thanks in advance,
James.