tnl2k7
Banned
- Messages
- 3,131
- Reaction score
- 0
- Points
- 0
Right,
I'm pretty new to PHP AND MySQL, so if you reply please could you provide a code snippet preferably with comments telling me what each line does?
Basically, I'm trying to use a content management system I wrote a while back in a way I never wrote it for. I'm gonna have to re-write it which is fine, but I don't know how to make it work.
I want to be able to process PHP code inside a variable that was retrieved from a MySQL request. For example, a user to goes to index.php?id=example. I then run a MySQL query:
to get this content from the database. When I send it to the browser using:
it outputs a load of PHP code rather than processing it and outputting that. How can I make PHP process the PHP code in the MySQL row rather than just sending it to the browser?
You can see the example I'm talking about with the PHP output here.
All help is appreciated and to the person who comes up with the best solution, I'll pay you 300 credits; I need help badly.
Thanks,
-Luke.
I'm pretty new to PHP AND MySQL, so if you reply please could you provide a code snippet preferably with comments telling me what each line does?
Basically, I'm trying to use a content management system I wrote a while back in a way I never wrote it for. I'm gonna have to re-write it which is fine, but I don't know how to make it work.
I want to be able to process PHP code inside a variable that was retrieved from a MySQL request. For example, a user to goes to index.php?id=example. I then run a MySQL query:
Code:
$id = $_GET['id'];
mysql_connect("localhost", "hidden", "hidden");
mysql_select_db("hidden");
$result = mysql_query("SELECT * FROM pages WHERE name='$id'") or die(mysql_error());
$row = mysql_fetch_array( $result )
$content = $row['content']
Code:
echo "$content";
You can see the example I'm talking about with the PHP output here.
All help is appreciated and to the person who comes up with the best solution, I'll pay you 300 credits; I need help badly.
Thanks,
-Luke.
Last edited: