如何将 link 作为 <html> href 添加到 mysql 数据库记录?
How to add link to mysql database record as a <html> href?
if($rezultat = $polaczenie->query($sql))
$ilu_userow = $rezultat->num_rows;
while($ilu_userow>0){
$wiersz = $rezultat->fetch_assoc();
$id = $wiersz['id'];
$like = $wiersz['likes'];
$price = $wiersz['price'];
echo '<div class="pozycja">
<span>
<h1><font color="blue"/> '
. $id . ' </h1></font><font color="red"/> '
. $like . ' </font><h2><strong><font color="green"/> '
. $price . '</h2></strong></font></span></div>';
$ilu_userow = $ilu_userow - 1;
}
这是我的代码,并且 - 正如主题中一样 - 我想为我从数据库中获得的每一行创建 html 地址,问题是 - 如何?
if($rezultat = $polaczenie->query($sql)) $ilu_userow = $rezultat->num_rows; while($ilu_userow>0){
$wiersz = $rezultat->fetch_assoc();
$id = $wiersz['id'];
$like = $wiersz['likes'];
$price = $wiersz['price'];
echo '<div class="pozycja">
<span>
<h1><font color="blue"/> '
. $id . ' </h1></font><font color="red"/> '
. $like . ' </font><h2><strong><font color="green"/> '
. $price . '</h2></strong></font></span>';
//added line start
echo '<a href="file.php?id='.$id.'">'.$id.'</a>';
echo '</div>';
//added line end
$ilu_userow = $ilu_userow - 1; }
if($rezultat = $polaczenie->query($sql))
$ilu_userow = $rezultat->num_rows;
while($ilu_userow>0){
$wiersz = $rezultat->fetch_assoc();
$id = $wiersz['id'];
$like = $wiersz['likes'];
$price = $wiersz['price'];
echo '<div class="pozycja">
<span>
<h1><font color="blue"/> '
. $id . ' </h1></font><font color="red"/> '
. $like . ' </font><h2><strong><font color="green"/> '
. $price . '</h2></strong></font></span></div>';
$ilu_userow = $ilu_userow - 1;
}
这是我的代码,并且 - 正如主题中一样 - 我想为我从数据库中获得的每一行创建 html 地址,问题是 - 如何?
if($rezultat = $polaczenie->query($sql)) $ilu_userow = $rezultat->num_rows; while($ilu_userow>0){
$wiersz = $rezultat->fetch_assoc();
$id = $wiersz['id'];
$like = $wiersz['likes'];
$price = $wiersz['price'];
echo '<div class="pozycja">
<span>
<h1><font color="blue"/> '
. $id . ' </h1></font><font color="red"/> '
. $like . ' </font><h2><strong><font color="green"/> '
. $price . '</h2></strong></font></span>';
//added line start
echo '<a href="file.php?id='.$id.'">'.$id.'</a>';
echo '</div>';
//added line end
$ilu_userow = $ilu_userow - 1; }