Jump to content

Insert a variable (eg $var) into MySQL


henryhenry

Recommended Posts

Hello!Does anyone know a technique to store a reference to a variable in MySQL?I want my table to hold the name of the variable - eg $varThen I want my page to take the name and get the value from the other part of the page...eg$var="hello world"then later in the page...query result would be: "This is an interesting $var"If you print the query result to the page you would see on the final page: "This is an interesting hello world"Is this possible? Maybe it's more of a PHP question - not sure?ThanksHenry

Link to comment
Share on other sites

  • 3 weeks later...
  • 2 weeks later...

HiI'd forgotten about this...hopefully you guys are still there to help me out :) Thanks!It's a bit of a theoretical question right now as I gave it a bit of a try and didn't manage it so I changed my approach. But I think it would be useful for a few things.A simple example would be:I have a heading stored in my database eg:This page is about {$title}But I want to use the same entry in the database to populate 5 pages with the following titles:This page is about SurfingThis page is about DivingThis page is about BodyBoardingThis page is about SwimmingThis page is about LivingSo the entry in the database doesn't record the actual value of $title but when you insert that entry into the page, you it would THEN look for $title and assuming it's set, then heading would alter accordingly.Hmmm... perhaps variable variables is the way forward but I can't quite see how that would do it...any thoughts?ThanksHenry

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...