I have the name of a php file stored in the database and i need to call that name and display that file on the current page. The code below tries to display a page called "$lay"

<?

$q = "select layout from HomeUser where username = '$username'";
$lay = mysql_query($q,$conn);

require_once '$lay';

?>

i solved the problem with the following code

<?

$user = $_SESSION['username'];
$q = "select layout from HomeUser where username = '$user'";
$lay = mysql_query($q);

while ($row = mysql_fetch_array($lay)) { 

require_once $row[layout]; 

}

?>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.