Hi I have been fighting for hours now and cant seem to work out what the issue is. I want to do a simple update query I have stripped it down to is bare minimum to try and get it to work but still no joy. If I was to run the update query directly in phpmyadmin then it works straight away but when i try to run it via php script it does not work. I get a message saying connection to my database is successful but that's about it. I have changed all the privilege settings to allow everything for the specific user but still nothing happens. the MySQL server is on a Godaddy server. The strange thing is I am able to insert new members into the database and also do select query fine. I have attached the code I am using below: <?php //Our connection details. $servername = 'localhost'; $username = '*********'; $password = '**********'; $dbname = 'members'; // Create connection $conn = mysqli_connect($servername, $username, $password, $dbname); // Check connection if (!$conn) { die("Connection failed: " . mysqli_connect_error()); } echo "Connected successfully"; $sql = "UPDATE members SET verified_account=1 WHERE member_id=1"; ?> Code (markup): If anyone is able to help it would be amazing
Add this after your sql if ($conn->query($sql) === TRUE) { echo"Record updated successfully"; } else { echo"Error updating record: " . $conn->error; } Code (markup): It may throw the error.