You are here: Re: PHP or Javascript for this? « PHP Programming Language « IT news, forums, messages
Re: PHP or Javascript for this?

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация