Probably it was similar question but I didn't find the right answer. I want to delete from table all rows with the same name but I want to get this name by ID. Here's what I'm doing in php:
if ($stmt = mysqli_prepare($link, "SELECT FROM projects WHERE id=?")) {
mysqli_stmt_bind_param($stmt, "s", $projectId);
mysqli_stmt_execute($stmt);
mysqli_stmt_bind_result($stmt, $project_name);
}
while( $row = mysqli_stmt_fetch($stmt) ){
$stmt = mysqli_prepare($link, "DELETE FROM projects WHERE name=?");
mysqli_stmt_bind_param($stmt, "s", $project_name);
mysqli_stmt_execute($stmt);
}
It doesn't work for some reason.