Welcome Guest, Not a member yet? Register   Sign In
Complex SQL -> converting to active records
#3

[eluser]JamesTaylor[/eluser]
Thanks Jedd, a bit more playing around and it appeared that my problem was being caused by a simple ',' being included in the sql!

i was trying
Code:
...ORDER BY distance LIMIT $limitValue, $OffsetValue
removing the ',' to make
Code:
...ORDER BY distance LIMIT $limitValue $OffsetValue
has solved my problem...

...although now the pagination works it has thrown up another problem! Always the case!

The intial search is triggered by a user inputing a postcode and distance into a form and hitting submit which passes the values through to the controller and onto the model etc... but now with pagination involved when i try to move to the 2nd page of results the controller doesn't recieve the values from the form (postcode and distance) which are needed to run the model and return the 2nd page of results??

What would be the advised way to make this work as although its the 1st time i have encountered such an issues in my short coding life i expect it isn't very uncommon... i'm thinking about storing the values in a session maybe but i figure that may be overkill??

Your mentioning of escaping the variables kinda raises an issue i was planning on looking into further quite soon across the entire application i am developing... my current understanding is that CI automatically escapes when using ActiveRecord but i would have to do it manually if i use traditional sql statments... is that correct?? ...as i plan to come on to this shortly i'll leave my questions at that for now and concentrate on trying to get the pagination / search results to function as intended!

Thanks again

james


Messages In This Thread
Complex SQL -> converting to active records - by El Forum - 12-10-2009, 09:30 AM
Complex SQL -> converting to active records - by El Forum - 12-10-2009, 10:05 AM
Complex SQL -> converting to active records - by El Forum - 12-10-2009, 10:46 AM
Complex SQL -> converting to active records - by El Forum - 12-10-2009, 10:47 AM
Complex SQL -> converting to active records - by El Forum - 12-10-2009, 11:11 AM



Theme © iAndrew 2016 - Forum software by © MyBB