A logical problem with two tables

Posted by Luke on Stack Overflow See other posts from Stack Overflow or by Luke
Published on 2010-06-15T18:41:48Z Indexed on 2010/06/15 18:42 UTC
Read the original article Hit count: 153

Filed under:
|

Hey guys, I created a list for fixtures.

$result = mysql_query("SELECT date FROM ".TBL_FIXTURES." WHERE compname = '$comp_name' GROUP BY date");
    $i = 1;
    $d = "Start";
    while ($row = mysql_fetch_assoc($result)) 
    {
        $odate = $row['date'];
        $date=date("F j Y", $row['date']);
        echo "<p>Fixture $i - $d to $date</p>";
    }

As you can see from the query, the date is displayed from the fixtures table. The way my system works is that when a fixture is "played", it is removed from this table. Therefore when the entire round of fixtures are complete, there wont be any dates for that round in this table. They will be in another table.

Is there anyway I can run an other query for dates at the same time, and display only dates from the fixtures table if there isnt a date in the results table?

"SELECT * FROM ".TBL_CONF_RESULTS." 
                               WHERE compid = '$_GET[id]' && type2 = '2' ORDER BY date" 

That would be the second query!

© Stack Overflow or respective owner

Related posts about php

Related posts about mysql