CodeIgniter Forums
get dynamic url slug in route file error - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Development (https://forum.codeigniter.com/forum-6.html)
+--- Forum: CodeIgniter 3.x (https://forum.codeigniter.com/forum-17.html)
+--- Thread: get dynamic url slug in route file error (/thread-67746.html)



get dynamic url slug in route file error - demonicinn - 04-04-2017

i'm getting the dynamic url slugs in route file from database.

but i'm getting error

here is the code

require_once(BASEPATH.'database/DB'.EXT);
$db =& DB();
$query = $db->get( 'your_table_name' );
$result = $query->result();
foreach($result as $row) {
   $route[ $row->slug ] = $row->controller_name;
}

Fatal error: require_once(): Failed opening required '/home/cmihub/public_html/real-estate/system/database/DBEXT' (include_path='.:/opt/alt/php56/usr/share/pear:/opt/alt/php56/usr/share/php') in /home/cmihub/public_html/real-estate/application/config/routes.php on line 56


RE: get dynamic url slug in route file error - InsiteFX - 04-04-2017

EXT is no long a constant in the newer CI versions, use the ext name.


RE: get dynamic url slug in route file error - demonicinn - 04-04-2017

can you send any example


RE: get dynamic url slug in route file error - Martin7483 - 04-04-2017

Just change this

PHP Code:
require_once(BASEPATH.'database/DB'.EXT); 

to this

PHP Code:
require_once(BASEPATH.'database/DB.php');