Why not just use
$dataarray[$row['id']] = $row['data'];
?
More Related Contents:
- Convert array of single-element arrays to one a dimensional array
- Convert array of single-element arrays to a one-dimensional array
- PHP – File to Associative Array with 1 key and two values attached
- How to Flatten a Multidimensional Array?
- In PHP, how do you change the key of an array element?
- Return single column from a multi-dimensional array
- Convert backslash-delimited string into an associative array
- Replace keys in an array based on another lookup/mapping array
- Restructure multidimensional array of column data into multidimensional array of row data [duplicate]
- Associative array, sum values of the same key
- Implode a column of values from a two dimensional array [duplicate]
- How to sort a date array in PHP
- Convert an associative array to a simple array of its values in php
- PHP combine two associative arrays into one array
- Check if a specific value exists at a specific key in any subarray of a multidimensional array
- Display array values in PHP
- Flatten multidimensional array concatenating keys [duplicate]
- Comment associative array in PHP Documentor
- PHP – Merge two arrays (same-length) into one associative?
- Flip associative array and store new values in subarrays to prevent losing duplicated values
- Create a comma-separated string from a single column of an array of objects
- Merge multiple associative arrays and add missing columns with a default value
- How to check if a specific value exists at a specific key in any subarray of a multidimensional array?
- Prepend associative array elements to an associative array
- Custom key-sort a flat associative based on another array
- Merge two numerically-keyed associative arrays and preserve the original keys
- PHP/SQL Insert Error when using Named Placeholders
- How to merge subarray values and remove duplicates?
- Implementing a simple lookup array
- Conditionally add associative element to array