note 75320 rejected from ref.array by tularis

From: Date: Fri, 25 May 2007 23:10:12 +0000
Subject: note 75320 rejected from ref.array by tularis
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-126929@lists.php.net to get a copy of this message
Note Submitter: spasme at gmail dot com ---- Hello guys! **You guys are my last solution please HELP!** I am having dificulty with the array() function: I am trying to populate an array from an MySQL quary and its not going to good :( (btw, a am trying to make an event/calendar script) the problem is with the $days variable. The manual way this should be set is as an array as follows: <?PHP $days = array ( 2=>array('#link','linked-day'), 20=>array('#link','linked-day'), ); ?> ... 2 & 20 being the dates in the month on wich i have an event This will later help in generating the calendar: <?PHP echo generate_calendar($year, $month, $days, 3, '#Luna', 0, $pn); ?> **1st try: <?PHP $result = mysql_query("SELECT * FROM events WHERE month='$month' AND year='$year'") or die ("Could not read data because ".mysql_error()); $days = array(); while ($qry = mysql_fetch_array($result)) { days[] = $qry[day]=> array ('#link', 'linked-day'); } ?> **2nd try: <?PHP $result = mysql_query("SELECT * FROM events WHERE month='$month' AND year='$year'") or die ("Could not read data because ".mysql_error()); while ($qry = mysql_fetch_array($result)) { $events.="$qry[day]=>array('#link', 'linked-day')"; } $days = array($events); ?> **3rd try: <?PHP $result = mysql_query("SELECT * FROM events WHERE month='$month' AND year='$year'") or die ("Could not read data because ".mysql_error()); $days = array(); while ($qry = mysql_fetch_array($result)) { array_push($days, $day);} } ?> And several other trys :sigh: I'd line to mention that in al examples, when i used print_r($days) or echo"$days"; the printout was OK but the generate_calendar() function didn't like it and didn't display any liked days. Please HELP! Thanks in advance!

« previous php.notes (#126929) next »