hi, just starting out with PHP and have the following script:
<?php
//This gets today's date
$date =time () ;
//This puts the day, month, and year in seperate variables
$day = date('d', $date) ;
$month = date('m', $date) ;
$year = date('Y', $date) ;
//Here we generate the first day of the month
$first_day = mktime(0,0,0,$month, 1, $year) ;
//This gets us the month name
$title = date('F', $first_day) ;
//Here we find out what day of the week the first day of the month falls on
$day_of_week = date('D', $first_day) ;
//today date
$today = date('j',$date);
//Once we know what day of the week it falls on, we know how many blank days occure before it. If the first day of the week is a Sunday then it would be zero
switch($day_of_week){
case "Sun": $blank = 0; break;
case "Mon": $blank = 1; break;
case "Tue": $blank = 2; break;
case "Wed": $blank = 3; break;
case "Thu": $blank = 4; break;
case "Fri": $blank = 5; break;
case "Sat": $blank = 6; break;
}
//We then determine how many days are in the current month
$days_in_month = cal_days_in_month(0, $month, $year) ;
//Here we start building the table heads
echo "<table border=1 width=294>";
echo "<tr><th colspan=7> $title $year </th></tr>";
echo "<tr><td width=42>S</td><td width=42>M</td><td width=42>T</td><td width=42>W</td><td width=42>T</td><td width=42>F</td><td width=42>S</td></tr>";
//This counts the days in the week, up to 7
$day_count = 1;
echo "<tr>";
//first we take care of those blank days
while ( $blank > 0 )
{
echo "<td></td>";
$blank = $blank-1;
$day_count++;
}
//sets the first day of the month to 1
$day_num = 1;
//count up the days, untill we've done all of them in the month
while ( $day_num <= $days_in_month )
{
$day_num++;
$day_count++;
//Make sure we start a new row every week
if ($day_count > 7)
{
echo "</tr><tr>";
$day_count = 1;
}
}
//Finaly we finish out the table with some blank details if needed
while ( $day_count >1 && $day_count <=7 )
{
echo "<td> </td>";
$day_count++;
}
echo "</tr></table>";
?>
How can I add some code to highlight what the current day is?
Thanks
Wrong Info sent Using $get in form
Hi i have this code that i tried to make to send some info from one page to aother with lots of ppls help and it works ok but when i have multiple files it doesnt send the correct info.What im tryin
How to extract/download content from HTTPS page?
Hello to all the Members of this forum, Im Shoiab, A novice programmer in php.. for my first job I have been recently assigned a project, in which I have got to extract/download the contents of the
mysqli_fetch_assoc returns multiple arrays, how to return a single array
Hello, I am using mysqli_fetch_assoc which is returning multiple rows, so it looks like:Code: [Select]while($row = mysqli_fetch_assoc($result)) { print_r($row);}But this returns multiple arrays
Access website from only 1 computer...?
One of my customers wants his website to only be accessed by people in which they bought the website membership from on their computer. He's afraid that the users might share their login's with their
Will this protect from mysql injection?
I do not want anything like DROP TABLE to work or any type of coding.. Heres my code.. is it secure? if not, please help:Code:
Print out contents of to Excel
I have got this script that gathers all the data that I need but I need it to send it to excel instead back to the screen in the web browser. How can I do this? Should I use something
BackButton Behaviour in AJAX
I have an ASPX Page AJAX Enabled!The page has a gridView and a DDL for filtering on it. The Gridview has links on its items. The behaviour I am running into is:If I filter a criteria from DDL and then
Problem!
I have another problem, when i run this code i get this error "Parse error: syntax error, unexpected T_ELSE in /home/a1408362/public_html/admin.php on line 41". I can't see why in the code
C - Reading a file into a byte array
Hi,I'm trying to read a file into a byte array in C. I have to use C as this is for a loadrunner script which is based on the C programming languageThe .Net code from the developers I'm basically
array_count_values question?
ok i'm trying to create a top ten list from a database of listed favorite movies.the following code yields me the correct order and number of votes for each movie$compare = array_count_values