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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T20:15:37+00:00 2026-05-24T20:15:37+00:00

I want to send whole sql command through ajax call as a argument. Do

  • 0

I want to send whole sql command through ajax call as a argument. Do I have to do escape it or to do something special about that?

Something like tools.php?database=db2&sql=select * from table

If escaping is necessary

  • how do I do it in javascript/jquery
  • what do I do then in php to read it

NOTE – very specific use-case & system settings

The web server is accessible only from inside our internal network. If anybody breaks in they can get all the databases so my ‘little application’ with I am improving via this question is not important at all. I have already implemented DROPping of whole database, updating whole columns, updating db’s settings etc via my web application. I just want to add this new feature. I might even happen that I am going to be the only use of this web application.

  • 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-24T20:15:38+00:00Added an answer on May 24, 2026 at 8:15 pm

    PEOPLE, DON’T USE THIS CODE IF YOU ARE NOT ABSOLUTELY SURE WHAT YOU ARE DOING

    This code is subject to catastrophical security breaches, so don’t use it unless you absolutely sure that no evil people will access it.

    Sending:

    jQuery.ajax({
        type: 'post',
        dataType: 'json',
        url: *your backend url here*,
        data: {database: 'db', sql: "select * from table"},
        success: function(data, textStatus){
            //perform any processing with data returned from backend here
        }
    });
    

    Receiving:

    <?php
        $sql = $_POST['sql'];
        $db = $_POST['db'];
        //db connection
        $result = mysql_query($sql);
        //processing query result, $rslt is processing result
        echo json_encode($rslt);
    ?>
    

    Hovewer, it’s not a good idea to send SQL from client, such an approach is extremely vulnerable to SQL-injections. But, if you are sure you want to shoot yourself in a leg…

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

Sidebar

Related Questions

I have a question about updating table through t-sql. The client may want to
I have mobile application, so i dont want to send/receive whole changes in tables..Just
I want so send every week an update by email. But Im afraid that
I want to send email from a Ruby application. Is there a call in
I want to send some strings in a list in a POST call. eg:
I have a Custom usercontrol that I want to enlarge. I tested this whit
I want to send an SMS as a User logs in to the sql
I have a process where I want the main thread to run through a
I want to send some unicode strings (for example ش) to my SQL DataBase
Often while I'm dealing with LINQ sequences, I want to send each item to

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.