iainlang Posted December 19, 2006 Share Posted December 19, 2006 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 | dataThe 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 https://forums.phpfreaks.com/topic/31219-cant-get-radio-station-broadcasting-schedule-right/ Share on other sites More sharing options...
chiprivers Posted December 19, 2006 Share Posted December 19, 2006 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 https://forums.phpfreaks.com/topic/31219-cant-get-radio-station-broadcasting-schedule-right/#findComment-144375 Share on other sites More sharing options...
iainlang Posted December 19, 2006 Author Share Posted December 19, 2006 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 https://forums.phpfreaks.com/topic/31219-cant-get-radio-station-broadcasting-schedule-right/#findComment-144377 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.