pgsjoe Posted March 15, 2006 Share Posted March 15, 2006 I've been building this calendar for weeks now! One last step is all I need. I need to create this....[code] $days = array( 2=>array('/weblog/archive/2004/Jan/02','linked-day'), 3=>array('/weblog/archive/2004/Jan/03','linked-day'), 8=>array('/weblog/archive/2004/Jan/08','linked-day'), 22=>array('/weblog/archive/2004/Jan/22','linked-day'), );[/code] What I need to have...[code]$days = array( //read database and if there is an event, of which there should be plenty... day of event=>array('$result = mysql query("SELECT * FROM `calendar` WHERE date is this date"),'linked-day' //I have no clue what this does),);[/code] Any ideas? Quote Link to comment Share on other sites More sharing options...
Steveo31 Posted March 15, 2006 Share Posted March 15, 2006 What is "date is this date", how are you getting those dates, etc? Quote Link to comment Share on other sites More sharing options...
pgsjoe Posted March 15, 2006 Author Share Posted March 15, 2006 [!--quoteo(post=355463:date=Mar 15 2006, 02:51 PM:name=Steveo31)--][div class=\'quotetop\']QUOTE(Steveo31 @ Mar 15 2006, 02:51 PM) [snapback]355463[/snapback][/div][div class=\'quotemain\'][!--quotec--]What is "date is this date", how are you getting those dates, etc?[/quote]Thank you for asking! Guess I should have worded it better.WHERE date is this date...is suppose to beWHERE the date here is the same as the date pulled by the array.Though, thinking about it a bit more, I don't think I necessarily need to have the dates in the array link to a new sql query. Simply making them targets that point to the ID number would be just fine. So, here's the updated..."what I need to create"[code]$days = array( //read database and if there is an event, of which there should be plenty... day of event=>array('# . $id','linked-day' //I have no clue what this does),);[/code] Quote Link to comment Share on other sites More sharing options...
XenoPhage Posted March 15, 2006 Share Posted March 15, 2006 [!--quoteo(post=355482:date=Mar 15 2006, 04:21 PM:name=PGS JoE)--][div class=\'quotetop\']QUOTE(PGS JoE @ Mar 15 2006, 04:21 PM) [snapback]355482[/snapback][/div][div class=\'quotemain\'][!--quotec--][code]$days = array( //read database and if there is an event, of which there should be plenty... day of event=>array('# . $id','linked-day' //I have no clue what this does),);[/code][/quote]Hrm.. array of arrays.. Good fun![code]$days = Array();while ($line = mysql_fetch_array($result)) { $days[$line[0]) = Array($line[1], $line[2]);}[/code]For my little example, $line[0] is the day of the week, $line[1] is '# . $id' and $line[2] is 'linked-day' .. All of those values are returned from the database.. I think that gives you what you want? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.