PHP code<?php require_once('../Connections/internal.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;
}
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO discuss (a, content) VALUES (%s, %s)",
GetSQLValueString($_POST['a'], "text"),
GetSQLValueString($_POST['content'], "text"));
mysql_select_db($database_internal, $internal);
$Result1 = mysql_query($insertSQL, $internal) or die(mysql_error());
}
mysql_select_db($database_internal, $internal);
$query_Recordset1 = "SELECT * FROM discuss";
$Recordset1 = mysql_query($query_Recordset1, $internal) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
discussWHO | 在说什么 | 楼 |
$result1 = mysql_query("SELECT * FROM discuss where id < 99 order by id ASC ");
while($row1=mysql_fetch_array($result1))
{
$id=trim($row1['id']);
$a=trim($row1['a']);
$content=trim($row1['content']);
echo
"
$a$content$id";
}
?>
选择你的身份
A
B
C
D