Good afternoon,
I'm hoping you guys can help me out with a simple problem. I am working on my first AJAX powered app, and I'm having a problem with the PHP portion. I am passing a value "q" from my app, that should return a Country name. Instead, I get a Resource id #3. My echo commands for $q and $sql are correct, and the generated query returns the proper result in MySQL query.
What am I missing?
$q = $_GET["q"];
$host="localhost";
$user="root";
$password="******";
$connection=mysql_connect($host,$user,$password);
$db=mysql_select_db("******",$connection)
or die (mysql_error());
$sql="SELECT Country FROM country WHERE CountryID = '" . $q . "'";
$result=mysql_query($sql)
or die(mysql_error());
echo $result . "<br />";
echo $q . "<br />";
echo $sql;
Sample result:
Resource id #3
0000000003
SELECT Country FROM country WHERE CountryID = '0000000003'
Thank you!!!
Eric