okay,, so what i wanna do is to get an array of pages from a MySQL database and include all of them onto my site,,
but i have tried and tried and cannot get it to work,, :thumbdown:
any advises?
Printable View
okay,, so what i wanna do is to get an array of pages from a MySQL database and include all of them onto my site,,
but i have tried and tried and cannot get it to work,, :thumbdown:
any advises?
Something like this?
PHP Code:$q = mysql_query(" YOUR QUERY HERE ");
while ($page = mysql_fetch_assoc($q) {
include($page['name'] . ".php");
}
just getting a parse error,,
explain better, it makes no sense
What is the error?
Are the pages .php
are the pages in the same map?
andsoforth :P
I want to include some .php pages and the pages i want to include are listed in an array in a mysql database
thats all i want :PCode:page1.php:page2.php:page3.php etc,,,
Why don't you just use the include function?
(I'm a noob at php shizzle, so please excuse me if I am doing totally wrong things..)PHP Code:<?php
include('page1.php');
include('page2.php');
include('page3.php');
?>
It should work fine like Guildjuhh said; just take the .'.php' out...?PHP Code:$q = mysql_query('SELECT `page` FROM `table`');
while ($r = mysql_fetch_assoc($q) {
include($r['page']);
}
Yeah, if he has the .php already stored in mysql mine wouldn't work becuase there is no file called 1.php.php :P