the page will be turned to another page or refreshed.
post.php
<html>
<body>
<a href = 'runsql.php?q_id=1'>run the mysql query!</a>
</body>
</html
runsql.php
<?php
$q_id = $_GET[q_id];
mysql_connect("localhost", "mysql_user", "mysql_password");
mysql_select_db('mysql_db');
if($q_id = 1)
mysql_query("insert into table(var) values ('ok')");
echo "mysql query have been run!";
?>
or you can try ajax.
it provid a way to submit a query without refresh.