I'm trying to convert a script from the use of a dat file to use mysql instead ->
The format being used for the dat file is currently:
2002::11:11:: Entry
YEAR::MONTH:😃AY:: Entry
The format being used for the SQL is:
Field 1 - Type: Date
Field 2 - Type: VarChar
Code which accesses and distributes the info (for the dat file):
$data = file('admin/schedule.dat');
echoing $data will output: "Array"
And my code for the MYSQL accessing:
$data = mysql_query("SELECT * FROM schedule",$db);
$myrow = mysql_fetch_row($data);
$myrow[0] = str_replace("-","::",$myrow[0]);
$data = ($myrow[0].":: ".$myrow[1]);
echoing $data will output: "2002::11::11:: Entry"
I need the $data from the SQL to be a Array as well...then it will be processed by (Otherwise I'd get a "Warning: Invalid argument supplied for foreach() " error) ->
Code which comes after either one:
foreach($data as $element) {
$element = trim($element);
$pieces = explode("::", $element);
$a[$pieces[0]][$pieces[1]][$pieces[2]] = $pieces[3];
}
TIA!
-Phil