You need to fetch result by mysql_fetch_array
or mysql_fetch_assoc
$row = mysql_fetch_array($result);
and
what mysql_query
return is
For SELECT, SHOW, DESCRIBE, EXPLAIN and other statements returning resultset, mysql_query() returns a resource on success, or FALSE on error.
For other type of SQL statements, INSERT, UPDATE, DELETE, DROP, etc, mysql_query() returns TRUE on success or FALSE on error.
Please, don't use mysql_*
functions in new code. They are no longer maintained and are officially deprecated. See the red box? Learn about prepared statements instead, and use PDO, or MySQLi - this article will help you decide which. If you choose PDO, here is a good tutorial.
After edit in question
This mysql_fetch_array($result);
Returns an array that corresponds to the fetched row and moves the internal data pointer ahead. So you must assigned that array to any variable to use like
while($row = mysql_fetch_array($result)){
echo $row ['field_name'];
}
Or
$row = mysql_fetch_array($result); // want to fetch only one row
echo $row ['field_name'];