Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > PHP Databases
| Search | Today's Posts | Mark Forums Read
PHP Databases Using PHP in conjunction with databases. PHP questions not specific to databases should be directed to one of the other PHP forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 15th, 2007, 02:55 AM
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

<?php
$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




Similar Threads
Thread Thread Starter Forum Replies Last Post
all field search surendran MySQL 6 December 22nd, 2006 12:20 AM
Active Search Field Tachyophan Access VBA 1 January 30th, 2005 01:00 PM
How to Search in nTEXT or TEXT field gaupa SQL Server 2000 1 December 21st, 2004 07:48 AM
How do you search datetime field? SoC Classic ASP Basics 6 October 31st, 2004 09:39 PM
Multiple Joins in Multiple Table Search query pookster Access 4 September 23rd, 2004 03:04 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.