0

I have a table in mysql database name contact_tbl that has a phone number field. inside this database I insert a value like this

<a href="tel:<?php echo $social->phone_number; ?>" title="<?php echo $social->phone_number; ?>"><i class="fas fa-phone fa-rotate-90"></i>  <?php echo $social->phone_number; ?></a>

this will create a link for a phone number that I will be echoing on the front end of the website. I did this because when someday I need to change the phone number it will be done by changing it in the database then all of the pages that has a phone number on the website will change as well.

The problem is that when I try to query and echo this on website it doesn't do anything. Do you know why?

Ace
  • 55
  • 6
  • Because PHP doesn't randomly evaluate any and all strings as PHP code. It would be quite the security disaster if it did. – deceze Oct 30 '18 at 01:31
  • It's a bad idea to store any sort of code (which you plan to actually evaluate) in your database. You should store *language neutral* strings, and replace *placeholders* within them specifically. Something like [`sprintf`](https://stackoverflow.com/a/28651098/476) is the established way to do that. – deceze Oct 30 '18 at 01:34

0 Answers0