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?

2
  • Because PHP doesn't randomly evaluate any and all strings as PHP code. It would be quite the security disaster if it did. Commented Oct 30, 2018 at 1: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 is the established way to do that. Commented Oct 30, 2018 at 1:34

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.