dimanche 28 février 2016

Web page on refresh, mysql update

Hello i have been having a little problem with my web page which have a db connection with an update statement. Now i have a button submit to which i should click the button and then updates the field in database. But on either entering the specific page or refreshing the page, it automatically updates the database. I have not set any function or anything else. Any help

I have the php code :

<?php 

$connect=mysqli_connect('127.0.0.1', 'root', 'root',"web");
if (isset($_GET['submit'])){
    $query = "UPDATE student AS t1 INNER JOIN employer AS t2 ON t1.stud_location = t2.emp_location SET t1.emp_id = t2.emp_id";
    $search_result =mysqli_query($connect,$query); 
} else { 
    $query = "UPDATE student AS t1 INNER JOIN employer AS t2 ON t1.stud_location = t2.emp_location SET t1.emp_id = t2.emp_id";
    $search_result =mysqli_query($connect,$query);
}
?>




Aucun commentaire:

Enregistrer un commentaire