SitePoint Sponsor |
|
User Tag List
Results 1 to 4 of 4
Thread: PHP in MySQL?
-
Jun 2, 2001, 10:19 #1
- Join Date
- Oct 2000
- Location
- Sheffield, UK
- Posts
- 437
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
PHP in MySQL?
Hi,
i am templating a site, and have aproblem.
in mysql, i have stored the way an article should be displayed, however instead of the name (for example "Hello World!")displays $title
anyhelp appreciatedNearly 7 years old!
-
Jun 2, 2001, 11:15 #2
- Join Date
- Nov 2000
- Location
- Hong Kong
- Posts
- 1,508
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Hi,
Could you show us with some code?
THanks
-
Jun 2, 2001, 11:22 #3
- Join Date
- Oct 2000
- Location
- Sheffield, UK
- Posts
- 437
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
PHP Code:function get_template($template_name) {
$gettemplate = mysql_query("SELECT * FROM templates WHERE template_name='$template_name'");
while ( $row = mysql_fetch_array($gettemplate)) {
$templatehtml = $row["code"];
echo("$templatehtml");
}
}
PHP Code:get_template("forumhome_usersonline");
there are $usersonline online users right now
(and in the database, the code is
Code:there are $useronline online users right now
Nearly 7 years old!
-
Jun 2, 2001, 11:27 #4
- Join Date
- Nov 2000
- Location
- Hong Kong
- Posts
- 1,508
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
You'll have to do a str_replace on the variable as php code in a database is not parsed.
So either str_replace or you must eval() the code.
Bookmarks