PHP MySQL problem
Moderator: General Moderators
-
TheCaptain
- Forum Newbie
- Posts: 3
- Joined: Thu Oct 21, 2004 7:47 pm
PHP MySQL problem
Im currently working on a site that is mostly php driven. Anyway I have a table in a db that has the fields name and content. What im doing is getting the content out of the db and displaying it. The problem is I put php code in the content field and when I get it and echo it it doesnt parse the code. How do I retrive php code from a db and then run it?
-
TheCaptain
- Forum Newbie
- Posts: 3
- Joined: Thu Oct 21, 2004 7:47 pm
-
TheCaptain
- Forum Newbie
- Posts: 3
- Joined: Thu Oct 21, 2004 7:47 pm
Ok here is the code I have. I have allready connected so dont worry about that.
In this case $row[content] would contain
But I get the error
Code: Select all
$result = mysql_query("SELECT * FROM pages WHERE name='$page'");
$row = mysql_fetch_array($result);
eval($rowїcontent]);Code: Select all
<? include "news.php"; ?>Code: Select all
Warning: Unexpected character in input: ''' (ASCII=92) state=1 in content.php on line 10
Parse error: parse error, unexpected '<' in content.php(10) : eval()'d code on line 1-
kettle_drum
- DevNet Resident
- Posts: 1150
- Joined: Sun Jul 20, 2003 9:25 pm
- Location: West Yorkshire, England