發新話題
打印

13章40頁

13章40頁

按照書中的操作
但是按了之後
出現"找不到該網頁"
程式碼如下
<?php require_once('../Connections/addd.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }
  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;   
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}
if ((isset($_GET['tIndex'])) && ($_GET['tIndex'] != "")) {
  $deleteSQL = sprintf("DELETE FROM topic WHERE tIndex=%s",
                       GetSQLValueString($_GET['tIndex'], "int"));
  mysql_select_db($database_addd, $addd);
  $Result1 = mysql_query($deleteSQL, $addd) or die(mysql_error());
}
if ((isset($_GET['tIndex'])) && ($_GET['tIndex'] != "")) {
  $deleteSQL = sprintf("DELETE FROM reply WHERE rtIndex=%s",
                       GetSQLValueString($_GET['tIndex'], "int"));
  mysql_select_db($database_addd, $addd);
  $Result1 = mysql_query($deleteSQL, $addd) or die(mysql_error());
  $deleteGoTo = "message.php";
  if (isset($_SERVER['QUERY_STRING'])) {
    $deleteGoTo .= (strpos($deleteGoTo, '?')) ? "&" : "?";
    $deleteGoTo .= $_SERVER['QUERY_STRING'];
  }
  header(sprintf("Location: %s", $deleteGoTo));
}
mysql_select_db($database_addd, $addd);
$query_del = "SELECT * FROM reply";
$del = mysql_query($query_del, $addd) or die(mysql_error());
$row_del = mysql_fetch_assoc($del);
$totalRows_del = mysql_num_rows($del);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" c />
<title>無標題文件</title>
</head>
<body>
</body>
</html>
<?php
mysql_free_result($del);
?>

TOP

資料庫連線設置檔案引入 <?php require_once('../Connections/addd.php'); ?> 的路徑怪怪的?
你只做這個範例嗎?還是混合很多?

TOP

發新話題