Inner join woes... and sweet tea!

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi everyone,

I'll admit right now that I'm still trying to wrestle with inner joins... Which leaves me with this code right here:

<?PHP

if(isset($_GET['cat'])) {
            $cat = mysql_real_escape_string($_GET['cat']);

        }

        if(isset($cat)) {
$sql = "SELECT * FROM ".$cfgtableContent." INNER JOIN ".$cfgtableCategories." WHERE ".$cfgtableContent.".postCat = ".$cat." ORDER BY ".$cfgtableContent.".postNumber DESC";

        }

?>

Now... I know the problem is probably staring an experienced inner join master in the face and I don't even have to say it... But for those who don't know or you might be searching the archives and want to learn from my blatant misunderstanding of inner joins I'll outline said problem in the following lines.

What I want to achieve: Add navigation by category to my blog. IE: If I want to display just Personal posts click on the "Personal" link and all other posts magically disappear.

What I'm getting now: I have 5 categories in my blog now... I get 5 copies of each post repeated down the site all with a different category...

All the variables are filled in correctly which I have checked with simple echo's. I have also tried removing the escaping of the data with no change so if possible I'd like to leave it in there as is :)

I have also tried switching it from the above to this:

<?PHP

$sql = "SELECT * FROM ".$cfgtableContent." INNER JOIN ".$cfgtableContent." WHERE ".$cfgtableCategories.".postCat = ".$cat." ORDER BY ".$cfgtableContent.".postNumber DESC";

?>

with no change...

Any ideas what I'm missing? :)



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux