Welcome Guest, Not a member yet? Register   Sign In
little issue with url redirect
#1

[eluser]coding[/eluser]
i want to redirect people to home page whenever they try to access undefined page.i've written an easy code but it isn't working.

first of all code......

Note:- I'm a newbie web developer and this is my first project I'm developing.( fun project)

This is the controller
-------------------------------------------------------------------------
function celebs()
{
$currenturl = current_url();
$compare = 'http://localhost/ci/index.php/home/celebs/';
if( $compare == $currenturl )
{
redirect('/home', 'refresh');
}
else
{
$data['query'] = $this->db->query('select * from celebs where cat_id = '.$this->uri->segment(3).' order by f_name');
$data['count'] = $this->db->query('select * from clips where celeb_id = '.$this->uri->segment(3).'');
$this->load->view('celebs',$data);
}

}
---------------------------------------------------------------------------------

now error

---------------------------------------------------------------------------------

A Database Error Occurred

Error Number: 1064

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'order by f_name' at line 1

select * from celebs where cat_id = order by f_name
------------------------------------------------------------------------------------


Messages In This Thread
little issue with url redirect - by El Forum - 08-09-2009, 08:07 AM
little issue with url redirect - by El Forum - 08-09-2009, 09:44 AM
little issue with url redirect - by El Forum - 08-09-2009, 09:50 AM
little issue with url redirect - by El Forum - 08-09-2009, 10:02 AM
little issue with url redirect - by El Forum - 08-09-2009, 10:03 AM
little issue with url redirect - by El Forum - 08-09-2009, 10:09 AM
little issue with url redirect - by El Forum - 08-09-2009, 10:23 AM



Theme © iAndrew 2016 - Forum software by © MyBB