douxing5598 2015-10-02 17:02
浏览 33
已采纳

使用php-mysql时如何显示带超链接的emaiIds

I am display the contents of mysql table using php. Based on the user inputs, I will do some querying and the results results will be stored in an array and displayed. Now I have emilIds in the output, when I display the table in the webpage, I want to display with hyperlinks. How can I achieve this. Thanks in advance.

if($result2->num_rows > 0){
    echo '<table width="100%" bgcolor="#FFFFFF" cellpadding="0" cellspacing="0" border="1" class="db-table" boarder-collapse ="collapse">';
    echo '<tr><th>STUDENT_NAME</th><th>CLASS</th><th>ID_NUMBER</th><th>ADDRESS</th><th>CITY</th><th>STATE</th><th>ZIP</th><th>COUNTRY</th><th>PHONE</th><th>INSURANCE</th>
<th>EMAIL</th><th>MAILING_ADDRESS</th><th>JOINED_ON</th></tr>';

    while($rowz2 = mysqli_fetch_assoc($result2)){
        echo "<tr>";
        foreach($rowz2 as $key=>$value){
            echo '<td>',$value,'</td>';
        }                                                                                                                     
        echo '</tr>';
   }
   echo "</table><br/>";


}

else{
    echo "<h2>No data based on the entered values</h2>";
}
  • 写回答

2条回答 默认 最新

  • doumen6532 2015-10-02 19:07
    关注

    I cannot comment yet so i will post it here. Check if your database column is 'email' or 'EMAIL' because

    if ($key == 'EMAIL')
    

    is case sensitive and as such it will never pass the condition if column is 'email'. If for some reason you need a case insensitive string comparison use:

    if (strcasecmp($key, 'EMAIL') === 0)
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭