IF STATEMENT HELP


Posted on 16th Feb 2014 07:03 pm by admin

Hi
i have created a calendar from a table:

Code: Calendar: October 2009
<table width=300 border="1">
<tr>
<th><a href="calendar.php"><</a></th>
<th>M</th>
<th>T</th>
<th>W</th>
<th>T</th>
<th>F</th>
<th>S</th>
<th>S</th>
<th><a href="calendar.php?nov09">></a></th>
</tr>
<tr>
<td></td>
<td>&nbsp; </td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
</tr>
<tr>
<td></td>
<td>5 </td>
<td>6</td>
<td>7 </td>
<td>8 </td>
<td>9 </td>
<td>10 </td>
<td>11 </td>
</tr>
<tr>
<tr>
<td></td>
<td>12 </td>
<td>13 </td>
<td>14</td>
<td>15 </td>
<td>16 </td>
<td>17 </td>
<td>18 </td>
</tr>
<tr>
<td></td>
<td>19 </td>
<td>20 </td>
<td>21 </td>
<td>22</td>
<td>23 </td>
<td>24 </td>
<td>25 </td>
</tr>
<tr>
<td></td>
<td>26 </td>
<td>27 </td>
<td>28 </td>
<td>29 </td>
<td>30 </td>
<td>31 </td>
<td>&nbsp; </td>
</tr>
</table>

The table works fine.
But i have a mysql table and it has some dates in it, so for example it has 01102009 which is the 1st October 2009 and it has another date eg. 12102009 which is the 12th October 2009 etc. I want it so that the table recognises the dates and the dates are shown in blue. I was going to do this like this:
Code: $booked = mysql_query("SELECT * FROM calendar WHERE `company` = '$logged[company]'");
$booked = mysql_fetch_array($booked);
echo'
<table border="1">
<tr>
<td>M</td>
<td>T</td>
<td>W</td>
<td>T</td>
<td>F</td>
<td>S</td>
<td>S</td>
</tr>
<tr>
<td>';
if($booked[datebooked] == "01102009"){
echo"<font color='blue'>01</font>";
}
else{
echo"01";
}
echo'</td>
<td>';
if($booked[datebooked] == "02102009"){
echo"<font color="blue">02</font>";
}
else{
echo"02";
}
echo'</td>
<td>03</td>
<td>04</td>
<td>05</td>
</tr>
</table>
';
And so on, this works the first time so 01 would be blue, but 12 would be normal, i know this is something to do with it only being able to select one at a time, but i dont know how to fix it, any ideas.
I could maybe use a while loop if anyone hasnt got any better ideas???
Thanks In Advance

No comments posted yet

Your Answer:

Login to answer
296 Like 45 Dislike
Previous forums Next forums
Other forums

asking for direction
I have 2 tables in my data, which are "post" and "event"
I won't make a summa

Multi Dimensional Array Append
Hi Guys

I have a function that returns a multidimentional array eg

$result = functio

xApp Analytics in BI 7.0
Dear all,

I am trying to implement xApp Analytics in BI 7.0. After I installed the analyt

Do something every fifth time?
I'm trying to write a loop, but I want it to do something different after every fifth instance. Like

checkbox update
I am having a brain fart right now and i cant remember how to do this. if anyone could help that wou

MySQL Does not UPDATE- SQLString Problem
vb Syntax (Toggle Plain Text) 1. SQL = "UPDATE sampletable SET column1 = 'C1sample1'"

How a counter of users ? such as ---> (231 Viewing)
I want to count how many users are actually viewing the page, How is that possible?
Thank you guy

bit of help needed
Im about to sort out my registration page for my website by customising a "registration" s

PHP MySQL and DATE
Hi everyone

I have a databse and in one of the columns I have date values such as 2009-March-

A little help in c#
i am doing a simple paint program using c# i want to draw with the mouse so i wrote the code of the

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash