Building an associative array form DB
Posted: Sat Aug 11, 2007 3:42 pm
I have a table with the following:
id, name, user, pass, date
I want select from it and format it so it returns like this....
This way I can use json_encode and have it formatted properly.... how would I set it up to return an array formatted like that?
id, name, user, pass, date
I want select from it and format it so it returns like this....
Code: Select all
$val = array("id" => 1,
"name" => "person",
"user" => "persons name",
"pass" => "persons pass",
"date" => ""
);