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

  • Home
  • SEARCH
  • 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 9068855
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T17:17:35+00:00 2026-06-16T17:17:35+00:00

I want to execute sql command such as $query_run = mysql_query($query); in php. But

  • 0

I want to execute sql command such as

$query_run = mysql_query($query);

in php. But the only way I can find to trigger php event is to submit a form using:

if(isset$POST['submit']) {
    $query_run = mysql_query($query);
}

But this would refresh the page and wipe off every thing that dynamically created on the page.

What I want is to have a button, press which to trigger sql commands without reloading the page like onclick in js. However, sql command cannot be run inside js function (as I can find).

  • 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-16T17:17:35+00:00Added an answer on June 16, 2026 at 5:17 pm

    PHP is parsed server side which means you can’t have it run code without making a server request. Once the page is delivered to the client any php parsing is complete.

    You can create a button or link that will send off an http request through javascript, an AJAX call, to a small php script that does the database work you want done. You wouldn’t have it call your whole page again. The output from this gets returned to the javascript and can be used to update a CSS block element with success or failure notices.

    Here’s the W3C Ajax tutorial http://www.w3schools.com/ajax/default.asp

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

Sidebar

Related Questions

i want to execute sql command with server name. here is some example query
How can I execute an SQL command through a shell script so that I
I want to create an SQL command in a MySQL/PHP environment where the NOT
I want to execute this command mysql -u root -e source F:\dump.sql How do
I want to execute an sql query (stored in a text file) from the
I want to know how to execute more than one SQL command at once.
Using SQL 2005: Taking too much time to execute I want to filter the
i want to execute some commands using NSIS script , but for the commands
i have a query that return only one row (always) and i want to
i want to execute a mysql stored procedure from mysql command prompt in phpmyadmin.stored

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.