Jump to content

further help with calendar


scarface83

Recommended Posts

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

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

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

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.