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 6474599
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:36:22+00:00 2026-05-25T06:36:22+00:00

So, I started to use MySQLi extension as I heard it will be the

  • 0

So, I started to use MySQLi extension as I heard it will be the supported one in the future. I read about that instead of using mysql_real_escape_string() I must use prepare() for security reasons, for example when I use a $_GET or $_POST in my query.

Is it true? I see that prepare() is good for making SQL query templates where I can change parameters. So the script can be dynamic on SQL level too. Its really useful. But I can’t find real info about its security measures. Is it really escapes evil stuff and protects from injection? Or I have to deal with it on programming level?

For example this code is safe? As you can see it use a $_GET to fill the template so it can be really dangerous if MySQLi prepare isn’t work as I want it to be.

$stmt = $mysqli->prepare('SELECT description,title FROM menu WHERE name = ?');

$stmt->bind_param('s', $n);

$n = $_GET['b'];

$stmt->bind_result($meta_description,$meta_title);
$stmt->execute(); 
  • 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-05-25T06:36:23+00:00Added an answer on May 25, 2026 at 6:36 am

    Prepared parameters are immune to injection because they get offered to the server after SQL was parsed, ie no way they can be interpreted as SQL fragments, which is the base of an SQL injection attack.

    In your example whatever is in the $_GET['b'] variable will be used by the server to compare with the name database field but there is absolutely NO WAY the server could be tricked into interpreting that text as a boolean equation, an end of statement followed by say a delete, …

    So by design it doesn’t offer SQL injection an attack surface, and that’s why using prepared statements is so much superior to all kinds of escaping and input scrubbing schemes.

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

Sidebar

Related Questions

In one of my Django projects that use MySQL as the database, I need
I started using github on Ubuntu. I use PHP/MySQL. All my applications are in
I have just started using XML as I usually use php but I am
Here's the problem: I started a swap today to use mysqli. No biggie, just
I've just started to extend the MySQLi class and found that member variables created
I've just started using ZF and there's some very handy libraries that save me
Thanks to a poster here at SO, I started using MySQLI and prepared statements.
I just started to use the PHP symfony framework. Currently I'm trying to create
I have started to use prepared statements in my php,mysql based application. As I
So recently I've really started to use php actively, and I need some insights

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.