tags:

views:

26

answers:

1

Hello,

For the code below, on the second link (http://www...com/sandbox/comments/index.php?submission='.$row["title"].'), I would like to pass $row["submissionid"], on as a GET variable. I tried this and it caused all of the code below to produce a blank result. Is there a way that I can do I want?

Thanks in advance,

John

$sqlStr = "SELECT 
                s.loginid
                ,s.title
                ,s.url
                ,s.displayurl
                ,l.username
                ,COUNT(c.commentid) countComments
             FROM 
                 submission s
            INNER
             JOIN
                 login l
               ON
                s.loginid = l.loginid
             LEFT OUTER
             JOIN
                 comment c
                ON
                 s.submissionid = c.submissionid
             GROUP
                BY
                 s.submissionid
             ORDER  
                BY 
                 s.datesubmitted DESC
             LIMIT 
                 10";           

$result = mysql_query($sqlStr);

$arr = array(); 
echo "<table class=\"samplesrec\">";
while ($row = mysql_fetch_array($result)) { 
    echo '<tr>';
    echo '<td class="sitename1"><a href="http://www.'.$row["url"].'"&gt;'.$row["title"].'&lt;/a&gt;&lt;/td&gt;';
    echo '</tr>';
    echo '<tr>';
    echo '<td class="sitename2"><a href="http://www...com/sandbox/members/index.php?profile='.$row["username"].'"&gt;'.$row["username"].'&lt;/a&gt;&lt;a href="http://www...com/sandbox/comments/index.php?submission='.$row["title"].'"&gt;'.$row["countComments"].'&lt;/a&gt;&lt;/td&gt;';
    echo '</tr>';
    }
echo "</table>";    
+1  A: 

Add submissionid to your select.

Tim
s.submissionid or c.submissionid?
John
I thought I tried this before... but I tried it again after you suggested it, using s.submissionid in the SELECT, and now for some reason it works. Go figure.
John
They will be the same, it doesn't matter which you choose, although s seems to make more sense based on what you already have.
Tim