Log in

Sep. 22nd, 2008 @ 01:17 pm problem with arrays

I wonder if someone here could help:

I'm working on a calendar that reads information from a database, the code I've borrowed uses an array to populate the calendar:

$days = array(






So logically I tried:

$select="SELECT * FROM calendar WHERE smonth='$month' ORDER BY sday";
$rows = mysql_query($select,$calendar);
while ($row = mysql_fetch_row($rows)) {

Which should give a similar result, however something doesn't work. Does anyone have any idea what is going on.
About this Entry
astro 10th aug 2007
Date:October 22nd, 2009 12:57 pm (UTC)
(Permanent Link)
Rather than try to populate at the end, populate as you go along. Replace:



$days[$day][0]="link"; $days[$day][1]="linked-day";

I realise this is a reasonably old post and you've probably solved it. I've never tried creating an array how you have, but if it works at all I would imagine your final ',' is throwing up the error. Perhaps you could also try:


Which will remove the final ',' before throwing into the array.
Date:October 22nd, 2009 01:00 pm (UTC)
(Permanent Link)
I completely skipped over the 2008 on that, REALLY old post. Nevermind me.