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).
mysql_*functions in new code. They are no longer maintained and are officially deprecated. See the red box? Learn about prepared statements instead, and use PDO or MySQLi - this article will help you decide which. If you choose PDO, here is a good tutorial.