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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T10:45:06+00:00 2026-06-10T10:45:06+00:00

Like my title, I want to know how to create a prepared statement without

  • 0

Like my title, I want to know how to create a prepared statement without using MySQLi or PDO. The main point is learning the process of creation and it’s security. I have nearly “ZERO-KNOWLEDGE” in this. Tried googling the topic but it seems that my googling skills have failed me. I’ve blindly learned that prepared statement is pretty secure from some websites but I do not see the actual point that it is secure. Can some of you clarify why it is? That would be a big help. I have my own assumption that creating a prepared statement is simply creating a function that receive string and replace all special character with str_replace like:

$org_sql = 'SELECT * FROM `my_table` WHERE `table_id`=?';
$prepared_sql = replaceQueryString($org_sql, 10);

function replaceQueryString($str, $replace) {
    // Do the replace where ? will be replaced by $replace here.
    return $str;
}

But I wonder if that will raise the level of the security, it looks rather plain to me.

If you don’t want to waste time answering this just point me to where the resource is available. So in summarize.

  1. How to create a MySQL prepared statement?
  2. Why it is secure?

Many thanks.

  • 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-10T10:45:08+00:00Added an answer on June 10, 2026 at 10:45 am

    There are two types of prepared statements, the emulated prepared statements and the native prepared statements. What you are doing is emulating the prepared statements.


    1.How to create a MySQL prepared statement?

    In php level, you could only emulate the prepared statement by replacing the placeholder with secure values. (Ex: quote the string, escape the special char, and so on…)

    2.Why it is secure?

    Because the prepared statements prevent the sql injection.


    PS:
    PDO has the option of PDO::ATTR_EMULATE_PREPARES, which enables or disables emulation of prepared statements.

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

Sidebar

Related Questions

I want to know how to get mp3 file details like artist, title, album
As the title already says, I'd like to know how to create a 1024x1024
I want to create a box like this with title: Can any one please
Like described in the title, I want to open a native ios viewcontroller when
I want to have my title tag look like this: My Website - Name
What I want to do is something like this: <asp:Label ID=titleLabel runat=server **Text='<%# SiteMap.CurrentNode.Title
As in the title, I want to test a method like this: public void
I want to create a new work item in TFS using the SDK, and
EDIT: Original Title: Question about the benefit of using an ORM. I want to
as the title describes i would like to create an image upload with ajax

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.