Jump to content

[SOLVED] Simple PHP & Query Question


yarub

Recommended Posts

I have a database with a table. In this table, I have a field for content. In this field.. I would like to be able to type $variable for instance and it know what I'm referring to. I have $variable designed earlier as "hamburger" and I would like it to pull up hamburger when I call for it through a mysql_fetch_array.

 

So saved into the database is "$variable" and not hamburger. But I would like it to say hamburger when it prints out.

 

Can anyone help me?

Link to comment
Share on other sites

PHP is meant to be written in files, why people insist on attempting to store it within a database is beyond me (your not the first however to ask this question).

 

Take a look at eval.

I don't think that's what he means. It sounds to me like you're trying to store the the value of $variable instead you're storing the string '$variable' it self. If I'm correct show us the code used to preform that insert into the database so we can tell you how to fix it.

Link to comment
Share on other sites

No no. Thorpe got me exactly what I wanted. I defined $variable elsewhere in a config script and I actually placed $variable into the content field in my database. Now when I write posts on my main page, I can call $variable instead of writing everything out. For instance, if I changed the name of my website, every post changes. :P Probably a bad way of doing it, but it's just a quick project.

 

Thank you!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.