I save a variable in my db row like this:

http://www.$site.com

When i fetch from my db it echo this :http://www.$site.com
but i have a variable $site='google' and i want to change $site to google automatically when fetched from db. Is there a way to this.

You could do it in the loop that fetches your DB records. E.g.

<?php
while(...) {
    $website = $record['website'];
    $website = str_replace('$site', $site, $website);
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.