• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 283
  • Last Modified:

Copy SQL record to array.

Hi,

I'm looking for a way to copy all fields within a 'mysql_fetch_assoc' into an array including the key names. I can do this, but can't copy the key names... Could anybody lend a bit of a hand?

Thank you,
Uni
0
Unimatrix_001
Asked:
Unimatrix_001
1 Solution
 
Lukasz ChmielewskiCommented:
Maybe like this:

$q = "select * from table";
$r = mysql_query($q);
while($w = mysql_fetch_assoc($r))
{
    $array[] = $w;
}

print_r($array);

Open in new window

0
 
Unimatrix_001Author Commented:
Oh... That's a little simpler than what I had... :S
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Tackle projects and never again get stuck behind a technical roadblock.
Join Now