View Single Post
Old May 15th, 2007, 02:55 AM
ddnk77872 ddnk77872 is offline
Registered User
Join Date: Jan 2007
Location: , , .
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default multiple field search

Hi guys and gals-

I am trying to make a search that search multiple fields ( firstname and lastname in a table.

This is the code I have right now that works, but when I try to add "AND" or "OR" things don't function

$colname_Recordset1 = "-1";
if (isset($_POST['search'])) {
  $colname_Recordset1 = (get_magic_quotes_gpc()) ? $_POST['search'] : addslashes($_POST['search']);
mysql_select_db($database_dot, $dot);
$query_Recordset1 = sprintf("SELECT * FROM dmd WHERE lastname = '%s'", $colname_Recordset1);
$Recordset1 = mysql_query($query_Recordset1, $dot) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);

Thanks in Advance