• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 271
  • 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

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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