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]; 

}

?>