Help with simple loop/sql/array question

Ok guys and gals I’m gettin’ old! I know this is simple but I’ve spent way too much time on this now and am crying ‘uncle’!

I’m trying load a multi-dementional array with mysql_fetch_array results but I’m not getting it. Here’s the rough basis for what I’m trying to do:

[php]$result = mysql_query(“SELECT * FROM phpbb_profile_fields_data”);
$row = mysql_fetch_array($result) or die(mysql_error());

$some_array = array(
array(
‘member_name’ => $row[‘pf_firstname’] . " " . $row[‘pf_lastname’],
‘member_title’ => $row[‘pf_title’],
‘member_employer’ => $row[‘pf_employer’],
),
array(
‘member_name’ => ‘Janet’,
‘member_title’ => ‘47’,
‘member_employer’ => ‘Husband’,
),
);[/php]

Okay, so that loads two $some_array elements with data. The first element has the first row of the database in question. Works fine but useless.

So, with a “while ($row = mysql_fetch_array($result) )” what do I need to do to fill the $some_array with the query results?

Thanks!

Here is the code to populate array with all records from query:
[php]
$some_array = array();
$i=0;
while ($row = mysql_fetch_array($result) ) {
$some_array[$i][‘member_name’] = $row[‘pf_firstname’] . " " . $row[‘pf_lastname’];
$some_array[$i][‘member_title’] = $row[‘pf_title’];
$some_array[$i][‘member_employer’] = $row[‘pf_employer’];
$i++;
}
[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service