Jump to content

require error in a function


canadabeeau

Recommended Posts

I have a php function in functions.php

function func_page_layout(){
$uri = $_GET['uri'];
if($uri == ""){
	$uri = "home";
} else {
	$uri = $uri;
};
$mysqli = func_db_connect();
$qry = "SELECT * FROM `pages` WHERE `uri`='$uri' LIMIT 1";
$result = $mysqli->query($qry, MYSQLI_STORE_RESULT);
$array = mysqli_fetch_array($result);
	$layout = $array['layout'];
require_once('themes/default/layouts/layout001.php');
};

 

now this is not working

 

but if in the page instead of executing the function I do the include straight out it works, any ideas?

 

the PHP error code(s)

Warning: require_once(themes/default/layouts/layout001.php) [function.require-once]: failed to open stream: No such file or directory in C:\inetpub\wwwroot\_inc\functions.php on line 148

Fatal error: require_once() [function.require]: Failed opening required 'themes/default/layouts/layout001.php' (include_path='c:\php\includes') in C:\inetpub\wwwroot\_inc\functions.php on line 148

 

Line #148 is

require_once('themes/default/layouts/layout001.php');

Link to comment
https://forums.phpfreaks.com/topic/186644-require-error-in-a-function/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.