简体   繁体   中英

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;
  }

This is my code, and - as in the topic - i want to create html adress to every row i get from my database, and the question is - how?

  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;   }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM