Hi everyone, I have a problem that is making me pull my hair out. Here goes: I have the following text in a mysql field $City is in the County of $County and within my php page I have $City = "Liverpool" $County = "Merseyside" What I want to happen is when the mysql field is echoed within the page it shows Liverpool is in the County of Merseyside but it actually shows $City is in the County of $County Any idea how I get the mysql variables to use the page variable values? I hope that makes sense as it is driving me nuts. Please help.......
How about something like: echo $City . " is in the county of " . $County; or: <p><?=$City?> is in the county of <?=$County?></p>
Cheers for the reply. The first wont work as the whole phrase $City is in the County of $County is in the mysql field. I tried the second and unfortunately that didnt work either. Thanks very much for trying
$your_mysql_string = ' $City is in the County of $County'; $your_mysql_string = str_replace(array('$City','$County'),array($City,$County),$your_mysql_string); echo $your_mysql_string; Code (php):
Had a little play and had to edit code a little so now its $your_mysql_string = str_replace(array("\$City","\$County"),array($City,$County),$your_mysql_string); echo $your_mysql_string; Code (php): And that works!!!! Thanks very Very much. I am now going to watch TV and have a cool beer. Thanks.