|
|||||||
New to SitePoint Forums? Register here for free!
|
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
SitePoint Addict
![]() ![]() ![]() Join Date: Mar 2006
Location: Calgary, Alberta, Canada
Posts: 368
|
PHP and mySQL - comparing data from two tables
Hello everyone. I am having a problem that I was hoping someone here would be able to assist me with.
I am using PHP and mySQL to create a site that reviews DVDs and Music. What I'd love to do is to create a list of release dates. In this list, I'd like it to look something like this December 5, 2006 DVD DVD Album Album November 29, 2006 DVD DVD Album Album Album November 27, 2006 Album I have 2 tables in my database. One to hold the information about my DVDs, and one to hold my information about my albums. What I can't seem to get, is for the data from both tables to display in this way. It's easy enough to do with the data from one table, as you just query the data, and display it, sorted by date. However, I guess what I am asking, is how do I compare the dates between the two tables, and then display the information (be it a DVD or an album) for all the selected date? At first I thought I could use a mySQL JOIN command, but then I don't get all the dates that don't have both a DVD and an album released, so I am assuming PHP. I am assuming I'd have to read both sets of dates out of the database, and into an array. Then, using a loop, loop through the dates and find any DVDs or albums that match, and display them. I am just not sure how I'd go about this, or if there is a better method. Any thoughts or advice? |
|
|
|
| Bookmarks |
«
Previous Thread
|
Next Thread
»
| Thread Tools | |
| Display Modes | |
|
|
|
All times are GMT -7. The time now is 02:42.









Threaded Mode