Relational Databases (mySQL/PHP)

They have: 71 posts

Joined: Aug 2001

Okay, here I am again asking once again about relational tables.

Anyway, the query that I have works fine in phpmyadmin but when it comes to writing to the browser it just won't do it.

Here is the code that I have to print it to the browser.

<?php
if ($articleid)  {

   
// Display each individual article
   
   
$query = \"SELECT * FROM members,articles WHERE articles.username = members.username AND articleid='$articleid'\";
   
$result = mysql_query($query);
    if (!
$result) {
        Query_Error(__FILE__, __LINE__,
$query, true);
    }

    if  (
$result && $h = mysql_fetch_array($result))  {

       
$day = substr($h['date'],6,2);
       
$month = substr($h['date'],4,2);
       
$year = substr($h['date'],0,4);

       
$hours = substr($h['date'],8,2);
       
$mins = substr($h['date'],10,2);
       
$secs = substr($h['date'],12,2);

       
$d = $month.\"/\".$day.\"/\".$year;
       
$t = $hours.\":\".$mins;

        printf (\"<b>%s written by <a href=\\"
mailto:%s\\">%s</a><br>\n\", $h['title'], $h['email'], $h['author']);
        printf ( \"Submitted on %s at %s</b>\n\",
$d,$t);
        echo \"<hr size=\\"
1\\" width=\\"100%\\" color=\\"#000000\\" NOSHADE>\";
       
printf (\"%s\n\", $h['article']);

    }

}
?>

In phpmyadmin ALL of the data required from the same query is returned but when it comes down to it on the actual site, only the data found in 'articles' is returned. Why? Sad

Please help me!

Adam.

They have: 71 posts

Joined: Aug 2001

Ignore that, I mananaged to do it - a mess up on my behalf.

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.