Welcome Guest, Not a member yet? Register   Sign In
Problem with uri segments
#1

[eluser]Atharva[/eluser]
Hi,

My problem with URI segments and may occur if user is destructive minded ( Confusedmirk: )

The initial link would be like
Code:
http://domain.com/index.php/controller/index/
When user clicks on a sorting link
Code:
http://domain.com/index.php/controller/index/resTakeOut/DESC/1/0
Where index is a function and rest are the parameters.
So the current uri segments are
1=>controller
2=>index
3=>resTakeOut
4=>DESC
5=>1
6=>0
So the problem I identify during destructive testing is that if I deletes a uri segment then it gives me a db error
eg: http://domain.com/index.php/controller/i...keOut//1/0[/code]
will give me a db error like
Code:
SELECT SQL_CALC_FOUND_ROWS * FROM cs_table where cId= 1 order by(resTakeOut) 1 LIMIT 0,10
This is due to the fact that CI will not identify the 'empty' uri segment between the two slashes '//'. So the new uri segments are
1=>controller
2=>index
3=>resTakeOut
4=>1
5=>0

So as you can see it takes uri segment 4 for order by (desc/asc) clause in the query which now will be '1' which is invalid for sql query.

So the whole problem lies in the fact that CI don't recognizes the empty uri between //. I have taken the default vales for the function index but it will not help since the uri segment 5 will be treated as segment 4. So I am wondering if there is any solution for this? I had a look at uri class but not sure how I can overcome this problem.

I appreciate your help. Thanks.


Messages In This Thread
Problem with uri segments - by El Forum - 04-28-2009, 02:02 AM
Problem with uri segments - by El Forum - 04-28-2009, 02:14 AM
Problem with uri segments - by El Forum - 04-28-2009, 02:47 AM
Problem with uri segments - by El Forum - 04-28-2009, 02:50 AM
Problem with uri segments - by El Forum - 04-28-2009, 03:26 AM
Problem with uri segments - by El Forum - 04-28-2009, 03:56 AM



Theme © iAndrew 2016 - Forum software by © MyBB