MySQL - field names

From: Date: Tue, 15 Aug 2000 11:33:52 +0000
Subject: MySQL - field names
Groups: php.general 
Request: Send a blank email to php-general+get-11777@lists.php.net to get a copy of this message
Typically when making a MySQL query I will do something similar to: $sql = "SELECT DISTINCT type FROM accttypes WHERE id=$requested_id"; $result = mysql_query($sql,$conn); while ( ($rs = mysql_fetch_array($result)) ) { $accttype = $rs[0]; } This strikes me as a bit clumsy, especially when lots of fields are returned (I forever find myself counting forward from 0 to get the correct number for a specific field!). I would much rather be able to access the record set pieces by their field name? Something like $accttype = $rs.type as per the above example? I wonder if someone would be kind enough to point me in the correct direction. Ollie

« previous php.general (#11777) next »