Multi-Word Searches
| From: | Dave Rosenberg | Date: | Tue, 02 Jul 2002 13:13:00 +0000 |
| Subject: | Multi-Word Searches | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-104904@lists.php.net to get a copy of this message | ||
I'm putting together a PHP/MySQL search and have run into a minor problem. I have a text field to fill in a keyword on one page and that brings up another PHP page "xxxx.com/showkey.php?id=division&search=Bob%20Cobb". Within that new page, you can sort the results by ID, and to do this I made the hyperlink go to, for example, "showkey.php3?id=project&search=$search". When I do this, however, it shortens the $search variable from "Bob Cobb" or "Bob%20Cobb" to just "Bob". Can anyone help? Thanks.... Dave
<?php
$db = mysql_connect("localhost", "webmstr");
mysql_select_db("contracts",$db);
$result = mysql_query("SELECT * FROM contracts WHERE project = '$search' OR agency = '$search' OR location = '$search' OR description = '$search' OR account = '$search' OR contact = '$search' OR division = '$search' ORDER BY $id",$db);
echo "<table width=750 border=1 cellspacing=0 cellpadding=1>\n";
echo "<tr><td width=255><b><font face=arial size=2>
<a href=showkey.php3?id=project&search=$search>Project Title</a></td>
<td width=50><b><font face=arial size=2><a href=showkey.php3?id=status&search=$search>......