Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8910315
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T03:39:34+00:00 2026-06-15T03:39:34+00:00

I am quite new to the FuelPHP framework. Right now I’m implementing an autocomplete

  • 0

I am quite new to the FuelPHP framework. Right now I’m implementing an “autocomplete” for a list of locations.

My code looks like this:

public function action_search($term=null){
    $clean_query =  Security::clean($term);
    $data["locations"] = array();
    if ($clean_query != "") {
        $data["locations"] = Model_Orm_Location::query()
                             ->where("title", "like", $clean_query."%")
                             ->get();
    }

    $response = Response::forge(View::forge("location/search", $data));
    $response->set_header("Content-Type","application/json");
    return $response;
}

As you can see, I’m concatenating a LIKE statement and it sort of feels bad to me. Is this code safe against SQL injections ? If yes, then is it because:

  • Security::clean will remove all mess;
  • where() in the ORM query will do the filtering?
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T03:39:35+00:00Added an answer on June 15, 2026 at 3:39 am

    Looking at the implementation of Security::clean in the source code of core/class/security.php, in your case the applied filters depend the configuration security.input_filter, which is empty by default. So no filter is applied.

    But when you dig deep into the database abstraction, you will see, that when the query is compiled just before execution, the query builder will apply quote on the value that was supplied in the where condition, which will then apply escape on string values. The implementations of that escape method depend on the DBMS connection:

    • mysql_real_escape_string for mysql,
    • mysqli::real_escape_string for mysqli, and
    • PDO::quote for PDO.

    This reflects today’s best practices. So, yes, this is safe against SQL injections.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im quite new to doctrine2. I need to make a connection like this: Tag
Iam quite new to functions in SQL and I would like to create a
I'm quite new to CSS / HTML, and can't find the cause of this
Am quite new to namespacing etc so hopefully this will be straightforward. I have
Quite new to this mocking thing, I have a couple of questions. Correct me
I'm not quite new but still have a few noob questions this is one
Quite new to functional languages, but I'm maintaining someone else's code with a lot
Quite new to this but i have created a SQL script that groups by
Quite new to xslt so forgive me if this is a basic question -
im quite new to android, so i apologise if this is a noob-ish question

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.