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
https://forums.phpfreaks.com/topic/171382-solved-simple-php-query-question/
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.

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!

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.