I'm trying to do a function that updates the field 'status' in the database from unpaid to paid on the click of a hyperlink/button. Here is what I'm doing but it is not working. Please help me debug my code.
function pay($idno, $secid) {
    $query = "UPDATE payments SET status='paid' WHERE idNumber = '$idno' AND sec_id = '$secid'";
    $result = mysqli_query($mysqli,$query); }
    $sec_id = '2';
    $idno= '3';
    echo "<td><a href='' onclick='pay($idno, $secid);' >PAY NOW</a></td>";
}
This is what I attempted but nothing is happening. My SQL connection is correct I've checked already.
 
     
    