![]() |
| ||
| Help with Database Query... Sorry, I posted this in the wrong area (I'm using MySQL) 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 |
| ||
| Re: Help with Database Query... I'd suggest using a view or a stored procedure. The syntax would be something like the following. SELECT Dayofweek, MAX(Timeslot) as 'Timeslot', MAX(AM/PM) as 'AM/PM', MAX(Description) as 'Description', MAX(Name) as 'Name', MAX(BIO) as 'Bio', MAX(Photo) as 'Photo' |
| ||
| Re: Help with Database Query... Thank you for your help, but I have other problems I guess. Here's the form I'm using to input my data to the database: <form action="<?=$PHP_SELF?>" method="post"> I insert the data with the following: $sql = "INSERT INTO shows SET Notice I have separate fields for Showday (Day of Week), Showdate (Actual Date), Showtime (Time of show),and AM/PM. I guess my first problem is: How do I merge those fields into a Date/Time form that MYSQL will recognize? I originally had all the columns as TEXT which worked except 12:00 Noon came after 11:00PM, so I changed the Showdate column to DATE and Timeslot to TIME, but I still have the AM/PM problem. Once I get the info inputted into MYSQL in the proper format, then I need to pull up schedules by week, day, and "Currently on the Air". But I need to know what I'm doing wrong with my data input first. Thank you so much!! Alan <EMAIL SNIPPED> |
| ||
| Re: Help with Database Query... It looks like your SQL syntax is incorrect. Read up on INSERT syntax here. Please keep us updated on your progress/trial & error. |
| ||
| Re: Help with Database Query... Hello, you may have a look at DATE_FORMAT(date, format), especially specifier %p to convert date and time values. krs, tesu |
| All times are GMT -4. The time now is 7:56 pm. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC