0

I'm pretty new to FuelPHP.

My first question is what is the best place to put custom functions? Right now, I just made a new file, func.php, inside the app/classes folder and access it like $func = new Func; $func->function_name(); - I don't think this is the best way to do it.

Secondly, for something I'm making, I'll be needing a lot of custom queries. Normally, I'd just use PDO's prepared statements and execute them, but I'm unsure how I'd go about sanitizing user input with DB::query(), without having to sanitize each individual variable.

tereško
  • 58,060
  • 25
  • 98
  • 150
Prash
  • 1,915
  • 3
  • 20
  • 32

1 Answers1

2

Autoloading function is not possible with PHP, so many people use classes, like you did... More information is available in this SO anwser: Autoloader for functions

For prepared statements, you got that: http://docs.fuelphp.com/classes/database/usage.html#binding

You still can use plain old PDO if you want, it's totally possible.

Community
  • 1
  • 1
Savageman
  • 9,257
  • 6
  • 40
  • 50