Jump to content

Can't get radio station broadcasting schedule right.


iainlang

Recommended Posts

I'm beginning to regret volunteering to help with the web site of a local independent radio station which has an upcoming temporary broadcasting licence...  They can't afford to hire someone who knows what he's doing, so I stupidly said "I'll do it".  Duh....

The database structure is -
id | date_of_broadcast | start_time | finish_time | firstname | surname | show_title | data

The following (which is minus all the cosmetics) produces only empty tables for each date.

$TableName="schedule";
$Query="SELECT distinct date_of_broadcast FROM $TableName order by date_of_broadcast";
$Result=mysql_db_query ($DBName, $Query, $Link);
while ($Row=mysql_fetch_array ($Result))
{
$dates_of_broadcast[]=$Row[date_of_broadcast];
}
$count=count($dates_of_broadcast);
$count--;
$n=0;
while ($n<=$count)
{
// get each day's date ;
$broadcast_date=$dates_of_broadcast[$n];
$broadcast_date=date("jS F Y", strtotime($broadcast_date));
print("<table>");
print("<tr><td><>$broadcast_date</font></td></tr>");

// now get the programmes for each broadcast_date ?? ;
$Query="SELECT * FROM $TableName where date_of_broadcast='$broadcast_date' order by start_time";
$Result=mysql_db_query ($DBName, $Query, $Link);
while ($Row=mysql_fetch_array ($Result))
{
print("<tr><td>$Row[start_time]</td><td>$Row[finish_time]</td><td>$Row[show_title]</td><td>$Row[firstname] $Row[surname]</td><td>$Row[data]</td></tr>");
}
print("</table>");
$n++;
}

print("</td></tr></table>");

Any help gratefully received.  Thanks!
Prior to your second query, you have changed the value of $broadcast_date to a display string:

$broadcast_date=date("jS F Y", strtotime($broadcast_date));


You are then using this new value in your query:

$Query="SELECT * FROM $TableName where date_of_broadcast='$broadcast_date' order by start_time";

I think that is probably where your problem is.  Perhaps create a new variable for the display and keep $broadcast_date as is to be used for the second query.

Following your reply, I changed the line to -
$Query="SELECT * FROM $TableName where date_of_broadcast='$dates_of_broadcast[$n]' order by start_time";

Bless yer lil' cotton sox - that seems to have done the business.  Words like "close" and "trees" and "forest" come to mind here...

Thanx!

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.