Simple Search Logic Issue...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Newbie question...


I have a search page with multi lines of search criteria:

Name
Topic
Message
Etc...

I'm hoping to get results based on what criteria I type - but I'm not
getting what I expect. I think it's just getting results where in addition
to getting search criteria I type - ALSO none of the search fields can be
blank (not what I hoped) ...

Like I type just 'c' in the name field and it shows 3 records (other search
fields filled up) ... But I have many more records with name containing 'c'

Goal: to search for what I type in whatever search fields and not worry
about whether others are blank or not - like:

Name contains 'c'

Charles
Chuck
Chuck
Chas

Or 

Name contains 'c' and topic contains 'test1'

Maybe just charles fits this criteria

----------


I made a simple results page,

... More code here ... ( DW CS3 )

$name_list1 = "-1";
if (isset($_GET['Name'])) {
  $name_list1 = $_GET['Name'];
}
$top_list1 = "-1";
if (isset($_GET['Topic'])) {
  $top_list1 = $_GET['Topic'];
}
$mess_list1 = "-1";
if (isset($_GET['Message'])) {
  $mess_list1 = $_GET['Message'];
}
mysql_select_db($database_test1, $test1);
$query_list1 = sprintf("SELECT * FROM mytable WHERE Name LIKE %s and Message
LIKE %s and Topic LIKE %s ORDER BY mytable.id desc", GetSQLValueString("%" .
$name_list1 . "%", "text"),GetSQLValueString("%" . $mess_list1 . "%",
"text"),GetSQLValueString("%" . $top_list1 . "%", "text"));

--
Thanks - RevDave
Cool @ hosting4days . com
[db-lists 09]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux