开发者

Need help adding a link to this script

I am using this script to display MYSQL data, but I need to make the ID data a link. I didn't write this script, found it on the internet so I don't know how because I'm not too experienced in PHP. Just need to add a simple href link.

$dbaddress = "localhost" ;
$dbname = "db" ;
$dbuser = "root" ;
$dbpw = "" ;
$tablename = "likes" ;

$link = mysql_connect($dbaddress, $dbuser, $dbpw);
mysql_select_db($dbname, $link);
echo "<table>\n" ;
echo "  <thead>\n" ;
echo "  <tr>\n" ;
echo "    <td>id</td>\n" ;
echo "    <td>item_content</td>\n" ;
echo "    <td>update_time</td>\n" ;
echo "  </tr>\n" ;
echo "  </thead>\n" ;
echo "  <tbody>\n" ;
$query = "SELECT * FROM `likes`" ;
$result = mysql_query($query,$link) ;
while ($row = mysql_fetch_array($result)) {
    echo "  <tr>\n" ;
    echo "    <td>".$row['id']."</td>\n" ;
    echo "    <td>".$row['item_content']."</td>\n" ;
    echo "    <td>".$row['upd开发者_JAVA百科ate_time']."</td>\n" ;
    echo "  </tr>\n" ;
}
echo "  </tbody>\n" ;
echo "</table>\n" ;

mysql_close($link) ;

Please help.


I think this is what you want: (also try to learn some basic stuff :)

    echo "    <td><a href='someotherscript.php?id=".$row['id']."'>link</a></td>\n" ;
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜