Simplify (shorten) this code.
$result = mysql_query("SELECT name FROM `pages`"); $r = mysql_fetch_array($result); $name = $r['name']; $name = mysql_fetch_array(mysql_query("SELECT name FROM `pages`"))['name']; See? =)
Write your class to work with the database, there make a function that will select the specified field as a parameter. Will you code in one line.
$name=mysql_result(mysql_query("SELECT name FROM `pages`"),0,'name'); Source: https://ru.stackoverflow.com/questions/133454/
All Articles