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!
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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!
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.