PHP – MySQL – Delete Records
Statement:
DELETE FROM table_name
WHERE some_column = some_value
<?php // Create connection // Statement: mysqli_connect(host,username,password,dbname) // NOTICE: se lo script è installato nello stesso server del Data Base, host->localhost $con=mysqli_connect("localhost","lucedigi_user","mypassword","lucedigi_testphp"); // Check connection if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } // Delete records START mysqli_query($con,"DELETE FROM Persons WHERE LastName='Griffin'"); // Delete records END mysqli_close($con); echo "Great! Connection Closed!"; ?>
phpMyAdmin
BEFORE
AFTER