Hello everyone,
I have 2 different datatables.
If i fill in my form, data will be saved in 2 different tables both have 1 same value and that is column NC_ref.
i have on a different page a button that give you the option to delete in both tables the row that contains in column NC-ref the same name.
So i use the next code.:
// Create connection
$conn = mysqli_connect($servername, $username, $password, $dbname);
// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
// sql to delete a record, deze doet niets schijnbaar
$sql = "DELETE FROM QCP_NC WHERE NC_ref=".$ref;
if (mysqli_query($conn, $sql)) {
echo "Record deleted successfully";
} else {
echo "Error deleting record: " . mysqli_error($conn);
}
mysqli_close($conn);
// Create connection
$conn1 = mysqli_connect($servername, $username, $password, $dbname);
// Check connection
if (!$conn1) {
die("Connection failed: " . mysqli_connect_error());
}
// sql to delete a record , deze werkt gewoon
$sql1 = "DELETE FROM QCP_NCstart WHERE NC_ref=".$ref;
if (mysqli_query($conn1, $sql1)) {
echo "Record deleted successfully";
} else {
echo "Error deleting record: " . mysqli_error($conn1);
}
mysqli_close($conn1);
The problem is that Conn1 connection works but the Conn not , i tryed also first conn1 then conn and that gifs no difference.
Why dos'nt works conn not? can't see the difference it should in my eyes work, but it dos'nt.