CodeIgniter Forums

Full Version: Function and DB questions
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hey all!

Questions:

1. I have this controller/function in my site(<?= anchor('register/cichat','Chat');?>) but when link is clicked it shows this http://REDACTED.com/index.php/register/login.php which leads to a 404 page not found. Being that the login function doesnt even exist why is it showing? This is the route I have:"$route['chat'] = 'chatpage(view file)';". How do I change this if possible?

2. Also Im trying to upload a table into my DB but the charset is not in the list of available sets(latin1). How do I upload the sql into my DB for my code to work?

Thank ya kindly all!

Heart Heart ,
Mekaboo
What is your $config['base_url'] value in application/config/config.php ?
Which other routes do you have in application/config/route/php ?
Which CodeIgniter version do you use?
(09-18-2019, 09:51 AM)Wouter60 Wrote: [ -> ]What is your $config['base_url'] value in application/config/config.php ?
Which other routes do you have in application/config/route/php ?
Which CodeIgniter version do you use?
Hey there Sir! Here are your answers:

Base url:  'http://REDACTED.com/' ( I noticed someone edited my post and changed the url)

"Routes"

$route['default_controller'] = 'welcome';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;
$route['login'] = 'login';
$route['register'] = 'register';
$route['user'] = 'user';
$route['form'] = 'form';
$route['validation'] = 'Form';
$route['redirect/profile'] = 'Login/profile';
$route['chat'] = 'chatpage';

$route['verifyEmail/(:any)'] = 'users/verifyEmail/$1';
$route['forgotPassword'] = 'users/forgotPassword';
$route['resetPassword/(:any)'] = 'users/resetPassword/$1';

Im using CI version 3.1.10.

Thank ya for the help Heart
You say the anchor in your view points to register/cichat.
I don't see a route for that, so CI expects to have a controller named "Register" and in that controller a function named "cichat". If you don't have that, a 404 error will occur.
Routes like
PHP Code:
$route['login'] = 'login' 
aren't necessary.

You also said you have this route:
PHP Code:
$route['chat'] = 'chatpage';  //view file 
A route never points to a view file. In this case, CI will look for a controller named Chatpage. If that doesn't exist, you'll get a 404 error.
(09-18-2019, 10:52 PM)Wouter60 Wrote: [ -> ]You say the anchor in your view points to register/cichat.
I don't see a route for that, so CI expects to have a controller named "Register" and in that controller a function named "cichat". If you don't have that, a 404 error will occur.
Routes like
PHP Code:
$route['login'] = 'login' 
aren't necessary.

You also said you have this route:
PHP Code:
$route['chat'] = 'chatpage';  //view file 
A route never points to a view file. In this case, CI will look for a controller named Chatpage. If that doesn't exist, you'll get a 404 error.
Super..will make this change soon within project..thanks alot Heart