简体   繁体   中英

I want to get the id value from database

I want to delete a row from my data-table so I need to get the id value from database and then delete it.

$id = $_GET['id'];
$result = mysqli_query($con, "DELETE FROM registre where id=$id");

This code doesn't get the id value from database, I don't have a row for id in my data-table so I need to get from to db and then delete it.

Try this using prepated statement :

$stmt = $mysqli->prepare("DELETE FROM registre where id= ?");
$bind = $stmt->bind_param('i', $id);
$exec = $stmt->execute();

Try this maybe it helps

 $id = $_GET['id']; $result = mysqli_query($con, 'DELETE FROM registre where id=' . $id);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM