PHP from a database?

Codes here !

Moderators: macek, egami, gesf

New php-forum User
New php-forum User
Posts: 1
Joined: Fri Nov 02, 2012 2:40 am

PHP from a database?

Postby JakeM » Fri Nov 02, 2012 2:47 am

Hi Guys,

From what I can tell, there is no other similar inquiry around...

I'm completing my Higher School Certificate (final year of high school in New South Wales Australia) and I'm creating a web system for a major.

Part of it requires me to have fully dynamic pages for my clients purpose, and I'm using database elements - so basically there is a BB Code site editor that translates [element=menu] to <?php elementCreate("menu"); ?>

What I'm finding for some reason I can't contemplate, is that it's just blatantly not working! And when I use view source the <?php elementCreate("menu"); ?> is green as if it's a comment?

Code: Select all

function bbElement($transform){   
   $a = array(
   $b = array(
      "<?php echo elementCreate($1); ?>",
   $transform = preg_replace($a, $b, $transform);
   return $transform;

Code: Select all

function elementCreate($element){
   $element_fetch = mysql_query("SELECT * FROM `elements` WHERE `element_name` = '".$element."'")or die(mysql_error());
   while($element_info = mysql_fetch_array($element_fetch, MYSQL_ASSOC)){
      $econt = $element_info['content'];
   return $econt;

:help: :help: :help:

It is highly likely I'm just missing something? But any help is appreciated! Cheers!

HELPME.jpg (34.7 KiB) Viewed 748 times

php-forum Super User
php-forum Super User
Posts: 1805
Joined: Thu Mar 10, 2011 5:07 pm

Re: PHP from a database?

Postby johnj » Thu Nov 08, 2012 8:28 am

check whether php is installed?

php-forum Fan User
php-forum Fan User
Posts: 973
Joined: Mon Oct 01, 2012 12:32 pm

Re: PHP from a database?

Postby seandisanti » Tue Nov 13, 2012 1:35 pm

Yeah i was going to say it sounds like you're trying to view the page as a file in a browser instead of through your web server.

Return to “mySQL & php coding”

Who is online

Users browsing this forum: No registered users and 3 guests