开发者

GET Variable Problem

开发者 https://www.devze.com 2022-12-21 15:08 出处:网络
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\" belo

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

精彩评论

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

关注公众号