TLN_CANADA
asked on
Getting array from database
Hi all,
I'm still learning PHP and am having some trouble creating an array that I can add the info to a PHP Chart.
Here is my call to the database.
Field names:
uname
exercise_id (primary key)
exercise_duration (int in minutes)
exercise_timestamp
and I need to output the array in this format:
The first column is the date (to be taken from exercise_timestamp) and the second column is the exercise time (to be taken from exercise_duration)
Could anyone assist me with this?
Thank you so much.
I'm still learning PHP and am having some trouble creating an array that I can add the info to a PHP Chart.
Here is my call to the database.
$query = mysql_query("SELECT * FROM exercising_table WHERE uname = '$username' ");
Field names:
uname
exercise_id (primary key)
exercise_duration (int in minutes)
exercise_timestamp
and I need to output the array in this format:
['24/01/12', 25],
['25/01/12', 26],
['28/01/12', 27],
['24/02/12', 25],
['15/03/12', 26],
['24/04/12', 27],
['21/06/12', 11]
The first column is the date (to be taken from exercise_timestamp) and the second column is the exercise time (to be taken from exercise_duration)
Could anyone assist me with this?
Thank you so much.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
while($row = mysql_fetch_array($query))
{
$data[] = $row;
}