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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T08:48:03+00:00 2026-05-21T08:48:03+00:00

How would I go about storing potential SQL injection attacks in a database? Assume

  • 0

How would I go about storing potential SQL injection attacks in a database?

Assume first that I have detected a potential attack, and have the offending attack string in a variable and would like to add it to a table containing a log of suspicious events.

What would I need to do to safely insert these strings into a database so that no errors would be produced?

I have a feeling that it will be something along the lines of htmlspecialchars and mysql_real_escape_string… but I wanted to throw it out there to see if anybody else had any ideas!

One thought was to store the attack as an encoded base64 value, but that seems a bit hackish…

FYI, I am writing the application in PHP 🙂

Any responses would be greatly appreciated!

  • 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-21T08:48:04+00:00Added an answer on May 21, 2026 at 8:48 am

    Always use parameterized queries. If you are using parameters, you don’t need to rely on escaping strings and your query will always do exactly what you intend.

    e.g.:

    $statement = $db->prepare('INSERT INTO table_name (field_name1, field_name2) VALUES (:value, :value2)');
    $statement->execute(array(':value' => $value, ':value2' => $value2));
    

    See documentation for PDO prepare here:

    http://www.php.net/manual/en/pdo.prepare.php

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

Sidebar

Related Questions

As a programmer I have no idea how one would go about programming menus
For the sake of argument assume that I have a webform that allows a
I have a view defined in SQL server 2008 that joins 4 tables together.
First, the setup: I have a table in an Oracle10g database with spatial columns.
I have a Dictionary<string,int> that has the potential to contain upwards of 10+ million
I have a question about best practices regarding how one should approach storing complex
I was thinking about creating a Web app that would let people enter text
I'm wondering how you would go about designing a good permgen space string in
How would a go about making a program where the user enters a string,
Using Python, how would I go about reading in (be from a string, file

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.