•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the MySQL section within the Web Development category of DaniWeb, a massive community of 402,911 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,093 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our MySQL advertiser: Programming Forums
Views: 321 | Replies: 2
![]() |
•
•
Join Date: Jul 2008
Posts: 4
Reputation:
Rep Power: 0
Solved Threads: 0
Hello all:
I'm currently building a website for a radio station and I want to setup a programming lineup. The fields I'm using are:
ID
Title
Dayofweek (Show Day)
Timeslot (Show Time)
AMPM (AM or PM)
Description
Name (Host Name)
Bio (Host Bio)
Photo (Host Photo)
I set these all up as TEXT as I wasn't sure how to do it correctly.
I want to be able to make a schedule listing the shows by Day of Week and then by Time, and I also want to make a box showing the current program on the air.
Any ideas for a newbie????
Thanks all!
Alan
I'm currently building a website for a radio station and I want to setup a programming lineup. The fields I'm using are:
ID
Title
Dayofweek (Show Day)
Timeslot (Show Time)
AMPM (AM or PM)
Description
Name (Host Name)
Bio (Host Bio)
Photo (Host Photo)
I set these all up as TEXT as I wasn't sure how to do it correctly.
I want to be able to make a schedule listing the shows by Day of Week and then by Time, and I also want to make a box showing the current program on the air.
Any ideas for a newbie????
Thanks all!
Alan
•
•
Join Date: Aug 2007
Location: Adelaide, South Australia
Posts: 364
Reputation:
Rep Power: 3
Solved Threads: 42
Couple of quick points:
ID fields should never be a text field. Use Unsigned INT or something similar. This helps efficiency and referential integrity of your tables.
Think about maybe consolidating the three columns Dayofweek, Timeslot and AMPM into one column, TimeOfDay, and making it a smalldatetime field, which is much nicer to work with than a straight text for dates and times.
Photo - you have a couple of choices, either this is a filename to the image of a photo, or better still make this a varbinary field and store the image's binary data directly in the database.
Ok, that said, for an SQL statement to list all shows by day and time, something like
should do for a start. You can always refine this statement with a WHERE clause to limit to a specific date if you want:
Hope this helps
darkagn
ID fields should never be a text field. Use Unsigned INT or something similar. This helps efficiency and referential integrity of your tables.
Think about maybe consolidating the three columns Dayofweek, Timeslot and AMPM into one column, TimeOfDay, and making it a smalldatetime field, which is much nicer to work with than a straight text for dates and times.
Photo - you have a couple of choices, either this is a filename to the image of a photo, or better still make this a varbinary field and store the image's binary data directly in the database.
Ok, that said, for an SQL statement to list all shows by day and time, something like
sql Syntax (Toggle Plain Text)
SELECT * FROM TableName ORDER BY TimeOfDay ASC
sql Syntax (Toggle Plain Text)
SELECT * FROM TableName WHERE TimeOfDay > '2008-07-17 00:00:00' AND TimeOfDay < '2008-07-17 23:59:59' ORDER BY TimeOfDay ASC
Hope this helps

darkagn
The answer is 42.
•
•
Join Date: Jul 2008
Posts: 4
Reputation:
Rep Power: 0
Solved Threads: 0
#3
Jul 19th, 2008
•
•
•
•
Couple of quick points:
ID fields should never be a text field. Use Unsigned INT or something similar. This helps efficiency and referential integrity of your tables.
Think about maybe consolidating the three columns Dayofweek, Timeslot and AMPM into one column, TimeOfDay, and making it a smalldatetime field, which is much nicer to work with than a straight text for dates and times.
Photo - you have a couple of choices, either this is a filename to the image of a photo, or better still make this a varbinary field and store the image's binary data directly in the database.
Ok, that said, for an SQL statement to list all shows by day and time, something like
should do for a start. You can always refine this statement with a WHERE clause to limit to a specific date if you want:sql Syntax (Toggle Plain Text)
SELECT * FROM TableName ORDER BY TimeOfDay ASC
sql Syntax (Toggle Plain Text)
SELECT * FROM TableName WHERE TimeOfDay > '2008-07-17 00:00:00' AND TimeOfDay < '2008-07-17 23:59:59' ORDER BY TimeOfDay ASC
Hope this helps
darkagn
Yes, the ID field is an INT,auto-increment,but the rest are TEXT.
I was trying to make the form easy for the programming director to use, therefore the 3 different columns. I've never played with DATETIME items much, so I'm not sure how to combine them as you say.
What the query would have to do is check the current day of week and limit results to that day, then check current time and show the programming for the last timeslot. (Example: Monday at 2:17 PM would return listing for the program that started at 2:00PM on Mondays).
Photos I'm simply inputting file anem and manually uploaded to the server. I've never stored binary data as you say and unsure how to do it.
Thanks for your help!
Alan
![]() |
•
•
•
•
•
•
•
•
DaniWeb MySQL Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
age amd avatar backup blue gene breach business chips daniweb data data protection database development dos economy energy enterprise europe government hacker hardware hp ibm ibm. news intel ibm it linux medicine memory microsoft news open source openoffice pc ps3 recession red hat russia security server sql sun supercomputer supercomputing survey technology trends ubuntu working x86
- Database Query Help (MS SQL)
- SQL statement to query user input?? (MS Access and FileMaker Pro)
- Error Executing Database Query on server (ColdFusion)
- Using PHP to connect to remote MSSQL database (PHP)
- conditional database query (ColdFusion)
- Javascript array from sql query (JSP)
- Database and ASP loops and hierarachal Data (ASP)
Other Threads in the MySQL Forum
- Previous Thread: Need urgent help Please
- Next Thread: Mysql error


Linear Mode