On This day in History… Array issues
Hello all, can someone spot the mistake in here… cos I can’t!
I am aiming to get an on this day on history function on my site… (eventually to do a google type image change in the header…) but for now theres a bug here and my brain cant see where I am going wrong
Many thanks
Mouse
[code]
<?php
// Array Structure: “Date”,”Quote”,”Year”
$allqts = array
(
“1410”, “tim created script…”, “2006”,
“1510”, “tim posts script on site…”, “2006”,
“1610”, “tim has minimal success…”, “2006”,
);
// Gets the Total number of Items in the array then Divides by 3 because there is a date then a Quote followed by a year
$totalqts = (count($allqts)/3);
// Subtracted 1 from the total because ‘0’ is not accounted for otherwise
$nmbr =($totalqts-1);
$nmbr = $nmbr*3;
// I think this is where it’s going wrong…
$quote = $allqts[$nmbr];
$nmbr = $nmbr+1;
$year = $allqts[$nmbr];
$nmbr = $nmbr+2;
$today = date(dm);
// check var is correct – remove later
echo $today;
if ($today == $allqts) {
echo ‘$quote’, ‘<br /> On this day in $year’ ;
}
else
echo ‘ – oooops no!’;
?>