不行还的求助版主或者各位前辈指点下小弟!
时间:2010-10-06
来源:互联网
复制代码
|
这是我写的后台按照会员帐户搜索会员的页面代码! 可是能搜索但是搜索出来不显示会员帐户,其他的信息都显示! 请教下代码那里又不对了嘛! 晕呼呼滴!
'700')this.width='700';if(this.offsetHeight>'700')this.height='700';" title="Click Here To EnLarge">
'700')this.width='700';if(this.offsetHeight>'700')this.height='700';" title="Click Here To EnLarge"> 我后来改了请求的变量!
代码如下
<?php require_once('../Connections/conn.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;
}
}
$colname_Recordset1 = "1";
if (isset($_GET['uname'])) {
$colname_Recordset1 = $_GET['uname'];
}
mysql_select_db($database_conn, $conn);
$query_Recordset1 = sprintf("SELECT * FROM userbiao WHERE uname like %s", GetSQLValueString("%" . $colname_Recordset1 . "%", "text"));
$Recordset1 = mysql_query($query_Recordset1, $conn) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
之前的是$colname_Recordset1 = "Request('uname')";
把这个改为了$colname_Recordset1 = "1";
然后可以搜索 但是只输入任何帐户 他就只显示和1有关联的帐户信息!
请教怎么回事哦! 那个值改如何写才正确呢!
[ 此帖被yk19880829在2010-10-06 18:36重新编辑 ]
作者: yk19880829 发布时间: 2010-10-06
你可以把值一个个打印出来看看,首先打印下$colname_Recordset1 ,在sql语句前和赋值后打印。然后再把这个的值打印看看,这样就可以GetSQLValueString("%" . $colname_Recordset1 . "%", "text") ,如果都没问题,最后打印下sql语句。这样一步一步下来应该能找到问题所在
作者: 刹那芳华网 发布时间: 2010-10-06
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28