执行Join Query后的GET变量

时间:2010-04-01 00:31:32

标签: php

对于下面的代码,在第二个链接(http://www...com/sandbox/comments/index.php?submission='.$row["title"].')上,我想将$ row [“submissionid”]作为GET变量传递。我试过这个,它导致下面的所有代码产生一个空白的结果。有没有办法让我能做到?

提前致谢,

约翰

$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"].'">'.$row["title"].'</a></td>';
    echo '</tr>';
    echo '<tr>';
    echo '<td class="sitename2"><a href="http://www...com/sandbox/members/index.php?profile='.$row["username"].'">'.$row["username"].'</a><a href="http://www...com/sandbox/comments/index.php?submission='.$row["title"].'">'.$row["countComments"].'</a></td>';
    echo '</tr>';
    }
echo "</table>";    

1 个答案:

答案 0 :(得分:2)

将submitid添加到您的选择中。