I'm trying to create an assosiative array from another associative array (a MySQL result set). I have a database table with SKU numbers for stock items and verbal descriptions of the items. I want to create an associative array of SKU's and their matching item descriptions (where SKU is the key and description is the value). This is the code I'm using,
//connects to the database
dbconnection();
$query_prog = 'SELECT sku, description FROM inv_summercamp';
$result_prog = mysql_query($query_prog) or die (mysql_error());
while ($row_prog = mysql_fetch_array($result_prog)) {
$prog_descriptions[] = array($row_prog['sku'] => $row_prog['description']);
}
but this creates arrays inside the $prog_descriptions array; I just want key=>value pairs inside the (single, one dimensional array) $prog_descriptions array.
Thanks for any suggestions!