开发者

GET Variable Problem

The table below works well. However, I am trying to pass $row["username"] along as a GET variable on the second hyperlink (the hyperlink in the second row that is clas开发者_C百科s "sitename2" below). When I hover over this hyperlink, everything is blank after the "profile="... there is no $row["username"] to be passed along. Any idea why the $row["username"] is not being appended to the end of this URL?

Thanks in advance,

John

EDIT: Sorry, I missed a simple mistake here. Thanks for the help... sorry for taking your time.

<?php


$sqlStr = "SELECT s.loginid, s.title, s.url, s.displayurl, l.username
             FROM submission AS s,
                  login AS l
            WHERE s.loginid = l.loginid
         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..../sandbox/members/index.php?profile=">'.$row["username"].'</a></td>';
    echo '</tr>';
    }
echo "</table>";    




?>


Because in your code, there is nothing after profile, see ?profile="

echo '.../index.php?profile=">'.$row["username"].'</a></td>';

You could add like this

echo '.../index.php?profile='.$row["username"].'">'.$row["username"].'</a></td>';


Try:

echo '<td class="sitename2"><a href="http://www.foo.com/sandbox/members/index.php?profile='.$row["username"].'">'.$row["username"].'</a></td>';
echo '</tr>';


Because you're only putting it in the anchor?

Try:

echo '<td class="sitename2"><a href="http://www.foo.com/sandbox/members/index.php?profile=' . $row["username"] . '">'.$row["username"].'</a></td>';
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜