Function StrNumber(StrInfo,StrTemp)
'StrInfo 总字符
'StrTemp字符串
If StrInfo <>"" And StrTemp<>"" And len(StrInfo)>len(StrTemp) Then
StrNumber=(len(StrInfo)-len(replace(StrInfo,StrTemp ,"")))/Len(StrTemp)
End If
End Function
'StrInfo 总字符
'StrTemp字符串
If StrInfo <>"" And StrTemp<>"" And len(StrInfo)>len(StrTemp) Then
StrNumber=(len(StrInfo)-len(replace(StrInfo,StrTemp ,"")))/Len(StrTemp)
End If
End Function
Quotation
Function selectstr(myint1,myint2,daystr)
do while myint1<=myint2
selectstr= ""&chr(10)
if myint1=daystr then
selectstr= ""&chr(10)
else
selectstr= ""&chr(10)
end if
if myint1=myint2 then exit do
response.Write selectstr
myint1=myint1+1
loop
end Function
do while myint1<=myint2
selectstr= ""&chr(10)
if myint1=daystr then
selectstr= ""&chr(10)
else
selectstr= ""&chr(10)
end if
if myint1=myint2 then exit do
response.Write selectstr
myint1=myint1+1
loop
end Function
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $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_update"])) && ($_POST["MM_update"] == "form2")) {
$updateSQL = sprintf("UPDATE artcat SET catname=%s, list=%s, pid=%s, `view`=%s, catcon=%s, menu=%s, ruby=%s WHERE id=%s",
GetSQLValueString($_POST['catname'], "text"),
GetSQLValueString($_POST['list'], "int"),
GetSQLValueString($_POST['pid'], "int"),
GetSQLValueString(isset($_POST['view']) ? "true" : "", "defined","1","0"),
GetSQLValueString($_POST['catcon'], "text"),
GetSQLValueString(isset($_POST['menu']) ? "true" : "", "defined","1","0"),
GetSQLValueString(isset($_POST['ruby']) ? "true" : "", "defined","1","0"),
GetSQLValueString($_POST['id'], "int"));
mysql_select_db($database_db, $db);
$Result1 = mysql_query($updateSQL, $db) or die(mysql_error());
}
?>
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $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_update"])) && ($_POST["MM_update"] == "form2")) {
$updateSQL = sprintf("UPDATE artcat SET catname=%s, list=%s, pid=%s, `view`=%s, catcon=%s, menu=%s, ruby=%s WHERE id=%s",
GetSQLValueString($_POST['catname'], "text"),
GetSQLValueString($_POST['list'], "int"),
GetSQLValueString($_POST['pid'], "int"),
GetSQLValueString(isset($_POST['view']) ? "true" : "", "defined","1","0"),
GetSQLValueString($_POST['catcon'], "text"),
GetSQLValueString(isset($_POST['menu']) ? "true" : "", "defined","1","0"),
GetSQLValueString(isset($_POST['ruby']) ? "true" : "", "defined","1","0"),
GetSQLValueString($_POST['id'], "int"));
mysql_select_db($database_db, $db);
$Result1 = mysql_query($updateSQL, $db) or die(mysql_error());
}
?>
mysql_affected_rows: 得到 MySQL 最后操作影响的列数目。
mysql_close: 关闭 MySQL 服务器连接。
mysql_connect: 打开 MySQL 服务器连接。
mysql_create_db: 建立一个 MySQL 新数据库。
mysql_data_seek: 移动内部返回指针。
mysql_db_query: 送查询字符串 (query) 到 MySQL 数据库。
mysql_drop_db: 移除数据库。
mysql_errno: 返回错误信息代码。
mysql_error: 返回错误信息。
mysql_fetch_array: 返回数组资料。
mysql_fetch_field: 取得字段信息。
mysql_fetch_lengths: 返回单列各栏资料最大长度。
mysql_fetch_object: 返回类资料。
mysql_fetch_row: 返回单列的各字段。
mysql_field_name: 返回指定字段的名称。
mysql_field_seek: 配置指针到返回值的某字段。
mysql_field_table: 获得目前字段的资料表 (table) 名称。
mysql_field_type: 获得目前字段的类型。
mysql_field_flags: 获得目前字段的标志。
mysql_field_len: 获得目前字段的长度。
mysql_free_result: 释放返回占用内存。
mysql_insert_id: 返回最后一次使用 INSERT 指令的 ID。
mysql_list_fields: 列出指定资料表的字段 (field)。
mysql_list_dbs: 列出 MySQL 服务器可用的数据库 (database)。
mysql_list_tables: 列出指定数据库的资料表 (table)。
mysql_num_fields: 取得返回字段的数目。
mysql_num_rows: 取得返回列的数目。
mysql_pconnect: 打开 MySQL 服务器持续连接。
mysql_query: 送出一个 query 字符串。
mysql_result: 取得查询 (query) 的结果。
mysql_select_db: 选择一个数据库。
mysql_tablename: 取得资料表名称。
/*
mysql_select_db
选择一个数据库。
语法: int mysql_select_db(string database_name, int [link_identifier]);
返回值: 整数
函数种类: 数据库功能
内容说明
本函数选择 MySQL 服务器中的数据库以供之后的资料查询作业 (query) 处理。成功返回 true,失败则返回 false。
*/
mysql_select_db($database_db, $db);//选择一个数据库。
$query_rs = "SELECT * FROM book";
$rs = mysql_query($query_rs, $db) or die(mysql_error());//送出一个 query 字符串。
$row_rs = mysql_fetch_assoc($rs);//从结果集中取得一行作为关联数组
$totalRows_rs = mysql_num_rows($rs);//取得结果集中行的数目
mysql_close: 关闭 MySQL 服务器连接。
mysql_connect: 打开 MySQL 服务器连接。
mysql_create_db: 建立一个 MySQL 新数据库。
mysql_data_seek: 移动内部返回指针。
mysql_db_query: 送查询字符串 (query) 到 MySQL 数据库。
mysql_drop_db: 移除数据库。
mysql_errno: 返回错误信息代码。
mysql_error: 返回错误信息。
mysql_fetch_array: 返回数组资料。
mysql_fetch_field: 取得字段信息。
mysql_fetch_lengths: 返回单列各栏资料最大长度。
mysql_fetch_object: 返回类资料。
mysql_fetch_row: 返回单列的各字段。
mysql_field_name: 返回指定字段的名称。
mysql_field_seek: 配置指针到返回值的某字段。
mysql_field_table: 获得目前字段的资料表 (table) 名称。
mysql_field_type: 获得目前字段的类型。
mysql_field_flags: 获得目前字段的标志。
mysql_field_len: 获得目前字段的长度。
mysql_free_result: 释放返回占用内存。
mysql_insert_id: 返回最后一次使用 INSERT 指令的 ID。
mysql_list_fields: 列出指定资料表的字段 (field)。
mysql_list_dbs: 列出 MySQL 服务器可用的数据库 (database)。
mysql_list_tables: 列出指定数据库的资料表 (table)。
mysql_num_fields: 取得返回字段的数目。
mysql_num_rows: 取得返回列的数目。
mysql_pconnect: 打开 MySQL 服务器持续连接。
mysql_query: 送出一个 query 字符串。
mysql_result: 取得查询 (query) 的结果。
mysql_select_db: 选择一个数据库。
mysql_tablename: 取得资料表名称。
/*
mysql_select_db
选择一个数据库。
语法: int mysql_select_db(string database_name, int [link_identifier]);
返回值: 整数
函数种类: 数据库功能
内容说明
本函数选择 MySQL 服务器中的数据库以供之后的资料查询作业 (query) 处理。成功返回 true,失败则返回 false。
*/
mysql_select_db($database_db, $db);//选择一个数据库。
$query_rs = "SELECT * FROM book";
$rs = mysql_query($query_rs, $db) or die(mysql_error());//送出一个 query 字符串。
$row_rs = mysql_fetch_assoc($rs);//从结果集中取得一行作为关联数组
$totalRows_rs = mysql_num_rows($rs);//取得结果集中行的数目
' ============================================
' 把字符串进行HTML解码,替换server.htmlencode
' 去除Html格式,用于显示输出
' ============================================
Function outHTML(str)
Dim sTemp
sTemp = str
outHTML = ""
If IsNull(sTemp) = True Then
Exit Function
End If
sTemp = Replace(sTemp, "&", "&")
sTemp = Replace(sTemp, "<", "<")
sTemp = Replace(sTemp, ">", ">")
sTemp = Replace(sTemp, Chr(34), """)
sTemp = Replace(sTemp, Chr(10), "<br>")
outHTML = sTemp
End Function
' ============================================
' 去除Html格式,用输于从数据库中取出值填入入框时
' 注意:value="?"这边一定要用双引号
' ============================================
Function inHTML(str)
Dim sTemp
sTemp = str
inHTML = ""
If IsNull(sTemp) = True Then
Exit Function
End If
sTemp = Replace(sTemp, "&", "&")
sTemp = Replace(sTemp, "<", "<")
sTemp = Replace(sTemp, ">", ">")
sTemp = Replace(sTemp, Chr(34), """)
inHTML = sTemp
End Function
' 把字符串进行HTML解码,替换server.htmlencode
' 去除Html格式,用于显示输出
' ============================================
Function outHTML(str)
Dim sTemp
sTemp = str
outHTML = ""
If IsNull(sTemp) = True Then
Exit Function
End If
sTemp = Replace(sTemp, "&", "&")
sTemp = Replace(sTemp, "<", "<")
sTemp = Replace(sTemp, ">", ">")
sTemp = Replace(sTemp, Chr(34), """)
sTemp = Replace(sTemp, Chr(10), "<br>")
outHTML = sTemp
End Function
' ============================================
' 去除Html格式,用输于从数据库中取出值填入入框时
' 注意:value="?"这边一定要用双引号
' ============================================
Function inHTML(str)
Dim sTemp
sTemp = str
inHTML = ""
If IsNull(sTemp) = True Then
Exit Function
End If
sTemp = Replace(sTemp, "&", "&")
sTemp = Replace(sTemp, "<", "<")
sTemp = Replace(sTemp, ">", ">")
sTemp = Replace(sTemp, Chr(34), """)
inHTML = sTemp
End Function




