Reputation:
<a href="tel:<?php echo $b2b_mec_num; ?>"><button type="button" class="btn" id="CallBtn"> 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'];
Upvotes: 0
Views: 455
Reputation: 81
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">
CALL
</button>
</a>
Upvotes: 1