This topic is locked

SQL view with stored procedure

5/13/2020 6:28:52 AM
PHPRunner General questions
J
jacques author

I hope that someone can help me out
In my header.php I have the code:
$_SESSION['page_name'] = basename($_SERVER['PHP_SELF'],".php");

$rs = DB::Select("header_footer", "page_name='".$_SESSION['page_name']."'" );

$find = $rs->fetchAssoc() ;

....
This works very good for all pages.
Then I created a SQL-view with a stored procedure
opening the new SQL-view list page I get a error

Fatal error/include/phpfunctions.php(1803): include() #1 /include/phpfunctions.php(1703): xt_include(Array)

all the other pages still working correctly
Removing the code described as before the SQL-view list page is working perfectly
anybody any idea??
gr
Jacques

Admin 5/13/2020

Make sure that in your header_footer table you have a record where page_name matches the current page name. This error happens because your SQL query returns no data.

J
jacques author 5/13/2020



Make sure that in your header_footer table you have a record where page_name matches the current page name. This error happens because your SQL query returns no data.


Thanks for your reply
The page_name exists in the header_footer table

I did a echo on $_SESSION['page_name'] and the value is exactly the same as in the header_footer table.
Strangely it works perfect on all other pages.

Admin 5/13/2020

Well, the error message says that $rs object is not created meaning that SQL query didn't return any results. You need to double-check the value of $_SESSION['page_name'] and that such a value exists in the database. I don't see any other reason and that would also explain why all other pages are working. Make sure you output the value of $_SESSION['page_name'] right before executing the SQL Query.