Hi everyone,
Scenario: Getting two variables from an HTML form ('id' and 'last_name') and I'm querying MySQL to get the first 3 letters of a field (last name) based on input 'last_name' where id is based on 'id'.
What I Did: I looked up the MySQL manual, found the LEFT() string function at: http://www.mysql.com/doc/en/String_functions.html, and then wrote the query as such:
$query = "SELECT LEFT('$last_name', 3)FROM sampleTable WHERE id='$id'";
$runQuery = mysql_query($query);
$rezultNUM = mysql_num_rows($runQuery);
if ($rezultNUM > 0)
{
echo "FOUND ITEM IN DB!";
}
else
{
echo "NOTHING FOUND!";
}
I checked this and it always returns "FOUND ITEM IN DB". Anyone have a clue as to what's going on?
Thanks a bunch.
Ilir.