0
我使用Dreamweaver cs4「插入」功能來管理單個頁面上的多個表單。但我有困難編輯代碼,以便它:需要幫助修改「股票」的PHP/MySQL的Dreamweaver代碼
- 從形式將數據插入到表
- 檢索新添加的行
- 的ID呼應了同一個頁面和上一個確認消息包含ID(作爲參考)
此處鏈接是什麼Dreamweaver中迄今已給了我...它應該只添加一個新行到數據庫(未經測試):
<?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"] == "form")) {
$insertSQL = sprintf("INSERT INTO tbl_solicitors (solicitorName, solicitorDetail) VALUES (%s, %s)",
GetSQLValueString($_POST['solicitorName'], "text"),
GetSQLValueString($_POST['solicitorDetail'], "text"));
mysql_select_db($database_speedycms, $speedycms);
$Result1 = mysql_query($insertSQL, $speedycms) or die(mysql_error());
}
?>
任何幫助將不勝感激......感謝和新年快樂!
lol這篇文章是如何編輯的? – methuselah 2009-12-29 06:04:04