MySQL数据库链接到HTML表 [英] MySQL database Links to HTML Table

查看:159
本文介绍了MySQL数据库链接到HTML表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想了解更多关于html,php和mysql的知识。我试图从数据库中检索一个链接,该链接存储为varchar,然后将其显示在表中。



每个条目都有不同的链接,它们是都链接到外部网站,我无法弄清楚这一点。
这里是我当前的代码。



 <?phpinclude(connection.php); $ sql =SELECT Username,Location,Points FROM database ORDER BY Points DESC; $ result1 = mysqli_query($ db_con,$ sql); while($ row1 = mysqli_fetch_array($ result1)):;?> < TR> < td>< a href ='。$ row ['Location']。'><?php echo $ row1 [0]; ?>< / A>< / TD> < td><?php echo $ row1 [1]; ?>< / TD> < td><?php echo $ row1 [2]; ?>< / TD> < / tr><?php endwhile; ?> <?php  



位置是链接存储的位置,正如你可以告诉我有一个相当悲伤的尝试,因为我不知道MySQL,PHP以及。



感谢您的时间!


 < td>  

< a href =<?php echo $ row ['link-column-name'];?>> Link< / a>< / td>


I am trying to learn more about html, php, and mysql. I am trying to retrieve a link from the database that is just stored as a varchar, then display it in a table.

Each entry will have a different link, they are all linked to external website and I couldn't figure this out. Here is my current code.

<?php

include("connection.php");
        
$sql = "SELECT Username, Location, Points FROM database ORDER BY Points DESC";
$result1 = mysqli_query($db_con, $sql);  

while($row1 = mysqli_fetch_array($result1)):;?>

  <tr>

  <td><a href="'.$row['Location'].'"><?php echo $row1[0]; ?></a></td>
  <td><?php echo $row1[1]; ?></td>
  <td><?php echo $row1[2]; ?></td>
                                        
  </tr>
<?php endwhile; ?>
						
<?php

The Location is where the links are stored, as you can tell I had a fairly sad attempt as I don't know mysql, php to well.

Thanks for your time!

解决方案

In your while loop:

 <td><a href="<?php echo $row['link-column-name']; ?>">Link</a></td>

这篇关于MySQL数据库链接到HTML表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆