Hi,
Im stuck doing a bit of coding which will take dates from a sql database then using two arrays compair the dates then produce like a table (only showing decades) with the years the band has been active colored different from the other years..this is the code i have so far, then ill explain the probs:
<?
function makedecadetable() {
$username="user";
$password="pass";
$database="data";
mysql_connect("local",$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT DatesActive FROM Biography WHERE Artist='{$_GET['band']}'";
$result=mysql_query($query);
$num=mysql_num_rows($result);
mysql_close();
$i=0;
while($i<$num) {
$dates = mysql_result($result,$i,"DatesActive");
$i++;
}
$activedates = explode("|",$dates);
$activenum = count($activedates);
$alldates = array("1910", "20", "30", "40", "50", "60", "70", "80", "90", "2000");
$i=0;
foreach($alldates as $dates) {
if($alldates[$i] == $activedates[$k]) {
echo '<td><div class="timeline-on">' . $dates . '</div></td>';
}if($alldates[$i] == $activedates[$k]){
echo '<td><div class="timeline-on">' . $dates . '</div></td>';
}
$i++;
}
}
?>
right the main problem is that i had it working but only so that you had to include the year 2000 this was using the array_slice the prob with that is that if the band say abba stopped being active in the end of the 80 beggining of the 90s which they did its really no good. is it? no!
so anyhelp with this would be great...
again just in case (cos i know its confusing but tell that to my sis(tbhe designer).).
i would like a timeline which shows from 1910 to 2000 but like this though... 1910 20 30 40 50 60 70 80 90 2000. but with the dates specified in the sql database...preferably like this 90 | 2000. but if that cant be done then any way is fine....
Thanks
i know its a challenge but if anyone can do it someone here can.