Posted by Philipp Grassl on 05/20/07 20:23
You could do it like
---
<?
if (isset($_GET['q']) && $_GET['q']=='y')
{
mysql_query(...);
header("Location: ?");
}
echo "<a href='?q=y'>Execute Query</a>";
?>
---
However, using this technique all the GET-variables would be cleared.
Also, I personally would use two PHP-Files, if you don't need to use the
returned data from the query in the first script:
--- file1.php
<?
echo "<a href='query.php'>Execute Query</a>";
?>
--- file2.php
<?
mysql_query(...);
[Do sth.]
header("Location: file1.php");
?>
---
Akhenaten schrieb:
> I'm wanting to create an hyperlink that will execute a mysql_query and
> then refresh the current page if it's clicked on. I've similar things
> created via javascript but didn't know if such was possible with PHP.
>
Navigation:
[Reply to this message]
|