I am new in php.Instead of using
$result=mysql_fetch_assoc($qry)
$result['id'];
i want to pass a variable instead of id like this
$id='id';
$result=mysql_fetch_assoc($qry)
$result[$id];
I have tried like this but not working.How can i pass a variable as argument to fetch a value from database
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. If you choose PDO, here is a good tutorial.mysql_will generates error.