【发布时间】:2015-06-29 07:33:15
【问题描述】:
下面是一个简单的脚本,用于从工作正常的表中删除信息,但这不会重定向到我需要它去的地方。有任何想法吗?之后我也尝试过使用die(); 等。
<?php
$dbservername = "xxxxx";
$dbusername = "xxxxx";
$dbpassword = "xxxxx";
$conn = mysql_connect($dbservername, $dbusername, $dbpassword);
$db = mysql_select_db("sxxxxx", $conn);
if (!$conn) { die('Could not connect: ' . mysql_error()); }
?>
<?php
session_start();
include"connect_db.php"; (this include, includes the above connection to db)
$content_id=$_GET['content_id'];
$username=$_SESSION['username'];
$sql = "DELETE FROM `user_blogs` WHERE `id`='".$content_id."' AND `username`='".$username."'";
$res = mysql_query($sql) or die(mysql_error());
header("location: user_page.php");
?>
【问题讨论】:
-
-
出于某种原因,上述评论并未添加到原始评论中(这是 connect_db.php)
-
我为你修复了代码显示。代码前缺少换行符。
标签: php header location connect