i have setup a database with this table structure:
$query = "CREATE TABLE entry ( entryID int NOT NULL AUTO_INCREMENT,
PRIMARY KEY(entryID),
URL varchar(4096),
name varchar(1024),
kw tinytext )";
I have filled in the database with data:
entryID
1
URL
http://www.bmwdealer.info/kwngat/9 Hite 6 Princesh...
name
02-Poni - Thashethemet-9 Hite 6 Princesha
kw
9
(data copied from a sample row from phpmyAdmin).
Now this is my code:
$term = '1';
$term2 = '9';
$query = "SELECT * FROM entry WHERE entryID = '$term' AND kw='$term2' ";
$result = mysql_query($query);
$numresults = mysql_num_rows($result);
echo $numresults."<br>";
if(!$result)
{
die('Invalid query: ' . mysql_error());
}
else
{ //something was found..
while($row = mysql_fetch_array($result))
{
echo "-Entry-<br>";
echo $row['entryID']."<br>";
echo $row['URL']."<br>";
echo $row['name']."<br>";
echo $row['kw']."<br>";
}
};
THIS CODE DOESNT GIVE ANY RESULTS AND THE PROBLEM APPEARS TO BE THE: AND kw='$term2' part of the QUERY because if i remove it, it DOES produce the expected result.
Any idea what is going on? Why is it not matching the kw field?
Please help me out with this
thanks alot, in advance..