用php删除记录

时间:2015-03-04 09:47:43

标签: php mysqli

我创建了一个php脚本来删除我的数据库中的行,但它不起作用。

这是我的剧本:

<?php
session_start();
include '../_database/database.php';
if(isset($_REQUEST['signup_button'])){
    $gallery_name=$_REQUEST['gallery_name'];
    $sql = "DELETE FROM gallery WHERE gallery_name=$gallery_name";
    mysqli_query($database,$sql) or die(mysqli_error($database));
    $_SESSION['user_username'] = $user_username;
    header('Location: ../home.php'.$user_username);
}
?>

1 个答案:

答案 0 :(得分:-1)

试试这个

$sql = "DELETE FROM gallery WHERE gallery_name='" . $gallery_name ."'";