Hi,
I'm trying to do a find query using the wildcard character %
Here is my piece of code:
function find_abstracts_title_author($find_string)
{
// query database for a list of categories
$conn = db_connect();
$query = "select Abstract_ID, Title, Last_Name, First_Name
from Abstract_Information, Presenting_Authors where Title like '".mysql_real_escape_string($find_string)."' or Last_Name like '".mysql_real_escape_string($find_string)."' or First_Name like '".mysql_real_escape_string($find_string)."'";
$result = @($query);
if (!$result)
return false;
$num_abstracts = @mysql_num_rows($result);
if ($num_abstracts ==0)
return false;
$_SESSION['num_abstracts'] = $num_abstracts;
$result = db_result_to_array($result);
return $result;
}
Now what I get in return is rather strange....
Abstract_ID:1
Title: PROTEOMIC MAPPING OF DYNAMIC PROTEIN-PROTEIN INTERACTIONS IN MAMMALIAN CELLS
Last_Name: Pelzing
First_Name: Mario
Abstract_ID:2
Title: TITLE2
Last_Name: Pelzing --> THIS IS NOT THE RIGHT LAST_NAME it should have been another last name
First_Name: Mario --> SAME HERE
The last name & first name seem to repeat itself and I expected only 1 result back and not 2 since my find string is Pel% and I have only one "Pelzing" in my table presenting authors...
Could someone help me?