My normal way of querying an SQL table (I’m using php) is by implementing the line below:
mysql_query("SELECT * FROM `TABLE_NAME` WHERE SOME CONDITION") or die(mysql_error());
I would like to query in a way that returns key/value pairs where the key is the column name. Can anyone suggest an elegant way to accomplish this.
Use
mysql_fetch_assoc()to read the row from the table.