当前位置: 动力学知识库 > 问答 > 编程问答 >

javascript - How to add phone numbers from database to <a href="tel:"> tag

问题描述:

<a href="tel:<?php echo $b2b_mec_num; ?>"><button type="button" class="btn" id="CallBtn">&nbsp;CALL</button></a>

I need to add phone numbers from database to the anchor tag above.

How do I do that?

Edit from Comment:

$sql_m="select * FROM b2b_mec_tbl where b2b_shop_id=$b2b_shop_id"; // tracking table $sql_mec=mysqli_query($con,$sql_m) or die(mysqli_error());

$row_mec=mysqli_fetch_array($sql_mec);

$b2b_mec_num=$row_mec['b2b_mobile_number_1'];

网友答案:

You were close here is how I would do it.

<?php 
$con='DBCONNECT STRING HERE';
$sql_m="select * FROM b2b where b2b_id = '$b2b_id'";
$sql_mec=mysqli_query($con,$sql_m) or die(mysqli_error());

while($row_mec=mysqli_fetch_array($sql_mec)){ 
  $b2b_mec_num=$row_mec['b2b_mobile'];
}
?>

<a href="tel:<? echo $b2b_mec_num; ?>">
  <button type="button" class="btn" id="CallBtn">
    &nbsp;CALL
  </button>
</a>
分享给朋友:
您可能感兴趣的文章:
随机阅读: