Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

merging variables into mysql result

Status
Not open for further replies.

admoore

IS-IT--Management
May 17, 2002
224
US
I have a variety of text strings stored in a MySQL database which need to be combined with variables in php....
The variable NAMES are stored as text within the data which needs to be replaced with the variable VALUES
example-
contents of SQL varchar data field: "some text $var1 more text $var2 ..."
needs to become a string where the literal $var1, etc is replaced with the actual variable...
I tried a variety of methods to concatenate the $var within the stored text,i.e. "some text '.$var1.' more text '.$var2"; but, to no avail...

Ideas?

TIA,

-Allen M.

 
Figured it out by using str_replace() function...
 
Look into eval() for an easier way. But be very careful when using it.

----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Web & Tech
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top