How do I fetch an integer value from the database?
$query = mysql_query('select number from table_name where UNIQUE_ID =SOME_UNIQUE_ID');
I am unable to access the integer value using the query above.
How do I fetch an integer value from the database?
$query = mysql_query('select number from table_name where UNIQUE_ID =SOME_UNIQUE_ID');
I am unable to access the integer value using the query above.
As many have commented, it's unclear what is the problem your are facing.
The $query variable you are obtaining is NOT the integer you want but a "query object" (or False if the query failed). You have to extract at least a row using (e.g.) $t=mysql_fetch_array($query). The wanted value will be in $t[0].
Keep in mind, anyway, that the result of a query is tipically a string, so you have to extract its integer value using intval($t[0]).
False because the query was invalid. Try putting quotes around variables values, like this: $src_no_query = mysql_query('SELECT s_no from route201 where s_name ="$src_name"',$link);