pascalbianca Posted October 7, 2019 Share Posted October 7, 2019 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. Link to comment Share on other sites More sharing options...
pascalbianca Posted October 8, 2019 Author Share Posted October 8, 2019 (edited) Little update. If i place the delete code only in a new test.php file it works great. So something else is i think the problem. SOLVED😣 My fold. I did a wrong action in my form. Edited October 8, 2019 by pascalbianca Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now