I must first apologise for asking a simple question but for ther life of me I have forgotton how to do this, I have tried a few things but have failed.
I need to put data into an array, currently the data is like this in the php code
$data = array("1" => .0032, "2" => .0028, "3" => .0021, "4" => .0033, "5" => .0034, "6" => .0031, "7" => .0036, "8" => .0027, "9" => .0024, "10" => .0021, "11" => .0026, "12" => .0024, "13" => .0036, "14" => .0028, "15" => .0025);
Now I want to get the same data from a MySQL database and put that data into the same array but I have forrgotten how.
MySQL table is "Gaps" with 2 fields "Day" and "Gap"
In the above data the key is the day and the value is the gap. example Day 1 - Gap = .0032 etc etc
When I do the SQL query below how do I load the fileds day and gap into the array to achive the same array I the hard coded version above
$dataArray=array();
//get data from database
$sql="SELECT * FROM Gaps Order by day";
$result = mysql_query($sql) or die('Query failed: ' . mysql_error());
if ($result) {
while ($row = mysql_fetch_array($result)) {
**
what would I put here
**
}
}
Please help put an old mans brain back into gear. Thanks