Jump to content

I Want To Make A Link, That Runs A ySql Query When Pressed [Please Help]


-CrAzY-

Recommended Posts

<?php
echo "<a href=\"mypage.php?query=true\">Run Query</a>";
if(isset($_GET['query']) and $_GET['query'] == 'true'){
    $query = mysql_query('SELECT * FROM table');
}
?>

 

Assume u have mypage.php. When u click the link the page refreshes and becomes mypage.php?query=true. The part after the '?' is the url variable and its value. With the code im checking if the url variable is set, if so run the query. Hope its clear.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.