I know this question had been asked and answered by many, but I don't seem to be able to get this work on my side with the references I had found.
I understand that mysql is phasing out, but I just want to get this work. My idea is to update the selected row with the ID I get from the previous page. Error and code are shown below.
Error:
Warning: mysql_query() expects parameter 1 to be string, resource given in C:\xampp\htdocs\file\doAttendance.php on line 8 doAttendance.php:
<?php
include "dbFunctions.php";
$id = $_REQUEST['id'];
$presence = 'Yes';
$selectQuery = mysql_query("SELECT * FROM guests WHERE id = '$id'");
$selected = mysql_query($selectQuery, $connect) or die(mysql_error($connect));
if (mysql_num_rows($selected) > 0) {
} else {
$sql = mysql_query ("UPDATE guests SET presence='$presence' WHERE id = '$id'");
$updated = mysql_query($sql, $connect) or die(mysql_error($connect));
}
?>