php - delete row in phpmyadmin
Solution:
<?php
if (isset($_POST['delete'])) {
$SQLSelect = $odb->query("DELETE FROM `accounts_free` ORDER BY `id` ASC LIMIT 1");
}
?>
Thats worked for me.
Answer
Solution:
First of all it seems to me that this is not PhpMyAdmin but your own PHP code. Second, as @ADyson and @arkascha suggested, you will want to specify which row to delete possibly using the row primary key. For example, you can add this inside your <form>
tags:
<input type="hidden" name="accounts_free_id" value="ACCOUT_FREE_ID_TO_DELETE">
And inside your if
:
//space removed as @arkascha suggested
$SQL = $odb->prepare("DELETE FROM `accounts_free` WHERE `id`='.$_POST['accounts_free_id'].'");
In this example I suppose the identifier of accounts_free
table is id
. This is only to give you the idea: remember that every input that arrives from the outside has to be checked to avoid SQL Injection or other kinds of attack attempts.