scarface83 Posted March 8, 2007 Share Posted March 8, 2007 Hi, can anyone help with the following the code <?php require('db_connect.inc'); // this includes the sql database connections details $cal_query = "SELECT tbl_colour.colour FROM tbl_colour,absence_mgt WHERE tbl_colour.value=absence_mgt.abs_value AND absence_mgt.datestamp='2007-02-01' "; $result = mysql_query($cal_query); // runs the above query $row = mysql_fetch_array($result); echo ($row['colour']); this echo's #FF0000 which is in the database but when i call it later on in the script $cal_event_opentd = "<td align=center bgcolor=$colour><b>"; it doesn't work any ideas ? thanks Link to comment https://forums.phpfreaks.com/topic/41804-further-help-with-calendar/ Share on other sites More sharing options...
legohead6 Posted March 8, 2007 Share Posted March 8, 2007 sorry, what are you tryin to achive? Link to comment https://forums.phpfreaks.com/topic/41804-further-help-with-calendar/#findComment-202752 Share on other sites More sharing options...
scarface83 Posted March 8, 2007 Author Share Posted March 8, 2007 its basically a absence management calendar im making to make my life easier at work, basically you click on a day on the calendar that then forwards you to another page with a form were you can select the type of absence i.e late would equal (value 1 which is equal to the colour #FF0000 ) and then it inserts it into the database and thats why i need this code so it checks the database for that timestamp that was selected on the calender and if it has a value assiocated with it it changes that days background to the colour the value equals. if you now what i mean if you want to see all the code let me know if its will help thanks Link to comment https://forums.phpfreaks.com/topic/41804-further-help-with-calendar/#findComment-202756 Share on other sites More sharing options...
mjlogan Posted March 8, 2007 Share Posted March 8, 2007 $cal_event_opentd = "<td align=\"center\" bgcolor=\"".$row["colour"]."\"><b>"; Link to comment https://forums.phpfreaks.com/topic/41804-further-help-with-calendar/#findComment-202758 Share on other sites More sharing options...
scarface83 Posted March 8, 2007 Author Share Posted March 8, 2007 that worked but it applied it to every day how would i get it to just apply the colour change to the one day ? Link to comment https://forums.phpfreaks.com/topic/41804-further-help-with-calendar/#findComment-202764 Share on other sites More sharing options...
artacus Posted March 8, 2007 Share Posted March 8, 2007 I dont think the original worked because you didn't have your color quoted. When you call it later you need to call it as $row['colour'] not just $colour... and that's only if you haven't overwritten the $row array in another db call. Link to comment https://forums.phpfreaks.com/topic/41804-further-help-with-calendar/#findComment-202780 Share on other sites More sharing options...
scarface83 Posted March 8, 2007 Author Share Posted March 8, 2007 I dont think the original worked because you didn't have your color quoted. When you call it later you need to call it as $row['colour'] not just $colour... and that's only if you haven't overwritten the $row array in another db call. it working now but im unsure how i would get it to apply the colour to just one day and not the whole year as its doing at the moment Link to comment https://forums.phpfreaks.com/topic/41804-further-help-with-calendar/#findComment-202787 Share on other sites More sharing options...
artacus Posted March 8, 2007 Share Posted March 8, 2007 I don't know, you'd have to work that out as you are looping thru each row. Were it me, I'd probably left join that color table in the query where I'm grabbing all the days of the month or whatever. Then if I had a color associated with that day, i'd put it in there. Link to comment https://forums.phpfreaks.com/topic/41804-further-help-with-calendar/#findComment-202814 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.