note 104829 deleted from function.mysql-fetch-array by thiago

From: Date: Sun, 10 Jul 2011 06:36:50 +0000
Subject: note 104829 deleted from function.mysql-fetch-array by thiago
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-181395@lists.php.net to get a copy of this message
Note Submitter: christopher at multidesignservices dot com ---- Here is an example of assigning keys and values from database columns: Database name: "table_name" --------------------------------------------- | some_data | other_data | --------------------------------------------- | 5 | frank | --------------------------------------------- | 11 | dan | --------------------------------------------- | 23 | christopher | ---------------------------------------------- $result = mysql_query("SELECT some_data, other_data FROM table_name"); while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $arr[$row["some_data"]] = $row["other_data"]; } mysql_free_result($result); RESULT: Array ( [5] => frank [11] => dan [23 ] => christopher )

« previous php.notes (#181395) next »