Forum Moderators: coopster
$e[] = $d;//store days in e for later
It correctly stores the days of the current month within $e[]
I then have a link on my page (outside of getMonth function)....
it gets add all from a link on the page that is the following...
<a href=\"admincourse.php?addall=addall&month=$month&year=$year&courseid=$courseid&d=$e\"><font color=\"#000000\"><u>Click Here</u></font></a>
and use the following code (outside the function) to try and find the array..
else if (isset($_GET['addall']))
{
$month=$_GET['month'];
$year=$_GET['year'];
$courseid=$_GET['courseid'];
$e[]=$_GET['d'];
print_r($e);
}
but i cant get the array data, can anybody help?
sorry if i am not reading between the lines but i think this is what you wanted to know.
$monthcal=$_GET['month'];
$yearcal=$_GET['year'];
$courseid=$_GET['courseid'];function getDays($month, $weekdays = '', $year = '') {
$weekdays = empty($weekdays)? array('Monday') : $weekdays;
$year = empty($year)? date('Y') : $year;
$days = date('t', mktime(0,0,0,$month,1,$year));
$out = array();
for ($i = 1; $i <= $days; $i++) {
$day = mktime(0,0,0,$month,$i,$year);
if (in_array(date('l', $day), $weekdays))
$out[] = $i;
}return $out;
}
$query = "SELECT day,time FROM coursetimes where time!= ''";
$result = mysql_query($query);
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
$day[]=$row['day'];
$time[]=$row['time'];
}$daylist = getDays($monthcal, $day, $yearcal);
// to output, simply implode()
echo "times: " . implode(', ', $daylist) . "<br />\n";
//insert into database
foreach ($daylist as $day) {
$queryins="INSERT INTO coursedates (courseid, day, month, year, time) VALUES ('$courseid', '$day', '$monthcal', '$yearcal', '$time')";
mysql_query($queryins) or die(mysql_error());
}
the problem is TIME, for example Monday could be 5 - 7 and friday could be 4.30 til 5.30. Hpw do I edit the function to include time also?! so that time is inserted into the database also
thanks!