Retrieving PHP from MySQL table

Codes here !

Moderators: macek, egami, gesf

TheSk8rJesus
New php-forum User
New php-forum User
Posts: 2
Joined: Tue Jan 08, 2013 3:09 am

Retrieving PHP from MySQL table

Postby TheSk8rJesus » Tue Jan 08, 2013 3:25 am

Hi,

Bit new to PHP but I'm currently trying to pull PHP from my MySQL table.

My table looks like this

name| content
page | <?php echo "hello world"; ?>

unfortunately when i run the following code on the page, all i get is the php shown on my page in plain text

Code: Select all

<?php
$query = mysql_query( "SELECT * FROM table", $connect );

while( $row = mysql_fetch_array( $query ) )
{
extract( $row )

echo $page;
}
?>


can someone let me know if this is possible, or am i showing the data incorrectly.

onadvance
New php-forum User
New php-forum User
Posts: 5
Joined: Mon Nov 07, 2011 10:36 am

Re: Retrieving PHP from MySQL table

Postby onadvance » Tue Jan 22, 2013 12:36 pm

Hi,

Try the following, it may help:

<?php
$query = mysql_query( "SELECT * FROM table", $connect );

while( $row = mysql_fetch_array( $query ) )
{
echo $row['page'];
}
?>


Return to “mySQL & php coding”

Who is online

Users browsing this forum: Bing [Bot] and 1 guest