To the point, I couldn't use function pararmeters in my REST controller... I don't want to say, that something not works, may be I do something wrong rather :)
I just want ot say, there is one another ability to works with get parameters by Input::get() or Input::param() - it works good :)
Sorry, my bad, wasn't paying enough attention to what you wrote.
Fuel hasn't been designed to use GET variables, it uses URI segments. Additional segments are mapped to action method arguments.
If you want to use GET variables, you have to use Input::get(). I try not to use Input::param(), it is not so much a problem with GET requests, but it allows you to easily fake a POST using the URI's query string, and that might be dangerous.
If you want to use GET variables, you need to get them using Input::get(). Fuel is designed to use URI segments.
And I have to warn you: writing queries like that is VERY insecure, your site will be open to SQL injection, and hacked within seconds. Use the query builder, and ALWAYS validate your input!
// assuming 0 is an invalid default value $movies = \Model_Movies::find_by_id_type( \Input::get('movies', 0));
If you don't use ORM:
// you don't need as_object() if you want array's returned $movies = DB::select()->from('movies')->where('id_type', '=', \Input::get('movies', 0))->execute()->as_object();
Note again that neither of these examples use validated input, you should really do that. So if your id_type should be a number, make sure it is!
You make it complicated for yourself, and you sacrifice security, your DB queries are not secure, you don't manually construct SQL anymore these days.
But if you insist, nobody is stopping you. Al least use the DB query builder then, instead of constructing the SQL by hand, so that input is properly escaped.
Have you enabled all error reporting? Have you enabled the profiler, and DB profiling? And what does that tell you?
My guess: 'id' is ambiguous, you have two 'id' columns in the result, and I assume the author id overwrites the book id... Use the table name prefix to indicate on which column you want to order.
This should give you a DB error though, so if you don't get that reported, your error reporting in develop mode isn't fully enabled.
I would like to get my book(s) with optional parameters : id , id_author and id_type
When i try with the id, it's good.
But when i try for id_author ... not working :/
$library = \DB::query("SELECT id, title, author, type FROM library WHERE id_author = " . $id_author . " ORDER BY id") ->execute();
Fuel\Core\Database_Exception [ 42000 ]: SQLSTATE[42000]: Syntax error or access violation: 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 id' at line 1 with query: "SELECT DISTINCT id, title, author, type FROM library WHERE id_author= ORDER BY id"