IF语句判断代码! 急 急 急求高手指点!
时间:2010-10-06
来源:互联网
<?php require_once('../Connections/conn.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$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;
}
}
mysql_select_db($database_conn, $conn);
$query_Recordset1 = "SELECT * FROM userbiao ORDER BY zhucedate DESC";
$Recordset1 = mysql_query($query_Recordset1, $conn) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?><!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" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<style type="text/css">
<!--
body,td,th {
font-size: 12px;
}
body {
margin-top: 0px;
}
.t {
border-top-width: 1px;
border-right-width: 1px;
border-bottom-width: 1px;
border-left-width: 1px;
border-top-style: solid;
border-right-style: solid;
border-bottom-style: solid;
border-left-style: solid;
}
-->
</style>
</head>
<body>
<table width="100%" border="0" cellpadding="4" cellspacing="0" class="t">
<tr background="/images/ssl_45.gif">
<td colspan="6" background="../images/ssl_45.gif"><strong>会员搜索:</strong></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="4">
<tr>
<td>会员帐户</td>
<td>代理/会员</td>
<td>是否冻结</td>
<td>是否锁定</td>
<td>全部资金</td>
<td>开户时间</td>
<td>详细</td>
<td>冲值</td>
<td>删除</td>
</tr>
<tr>
<td><?php echo $row_Recordset1['uname']; ?></td>
<td> <?php if $row_Recordset1['and']=0 VIP帐户;?><?php else 会员帐户;?> </td>
请问下我那个判断语句对不对呢 红色里面的<?php if $row_Recordset1['and']=0 VIP帐户;?><?php else 会员帐户;?> 其中and 字段我设置的是 int 默认值是0 我就想在前台显示是! 假如and字段值=0 那么显示VIP帐户 否则显示普通帐户!
上面的语句我测试N次就是不对! 不知道那里错了! 还请高手指点下! 感激不尽呐! 急!在线等解答
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$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;
}
}
mysql_select_db($database_conn, $conn);
$query_Recordset1 = "SELECT * FROM userbiao ORDER BY zhucedate DESC";
$Recordset1 = mysql_query($query_Recordset1, $conn) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?><!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" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<style type="text/css">
<!--
body,td,th {
font-size: 12px;
}
body {
margin-top: 0px;
}
.t {
border-top-width: 1px;
border-right-width: 1px;
border-bottom-width: 1px;
border-left-width: 1px;
border-top-style: solid;
border-right-style: solid;
border-bottom-style: solid;
border-left-style: solid;
}
-->
</style>
</head>
<body>
<table width="100%" border="0" cellpadding="4" cellspacing="0" class="t">
<tr background="/images/ssl_45.gif">
<td colspan="6" background="../images/ssl_45.gif"><strong>会员搜索:</strong></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="4">
<tr>
<td>会员帐户</td>
<td>代理/会员</td>
<td>是否冻结</td>
<td>是否锁定</td>
<td>全部资金</td>
<td>开户时间</td>
<td>详细</td>
<td>冲值</td>
<td>删除</td>
</tr>
<tr>
<td><?php echo $row_Recordset1['uname']; ?></td>
<td> <?php if $row_Recordset1['and']=0 VIP帐户;?><?php else 会员帐户;?> </td>
请问下我那个判断语句对不对呢 红色里面的<?php if $row_Recordset1['and']=0 VIP帐户;?><?php else 会员帐户;?> 其中and 字段我设置的是 int 默认值是0 我就想在前台显示是! 假如and字段值=0 那么显示VIP帐户 否则显示普通帐户!
上面的语句我测试N次就是不对! 不知道那里错了! 还请高手指点下! 感激不尽呐! 急!在线等解答
作者: yk19880829 发布时间: 2010-10-06
if (条件) {
...
} else {
...
}
...
} else {
...
}
作者: wxpcjrjgcs 发布时间: 2010-10-06
三目运算
<?php echo $row_Recordset1['and']=0?" VIP帐户" : "会员帐户";?>
普通的判断语句
<?php
if($row_Recordset1['and']=0){
echo " VIP帐户";
}else{
echo "会员帐户";
}
?>
<?php echo $row_Recordset1['and']=0?" VIP帐户" : "会员帐户";?>
普通的判断语句
<?php
if($row_Recordset1['and']=0){
echo " VIP帐户";
}else{
echo "会员帐户";
}
?>
作者: 莫愁 发布时间: 2010-10-06
谢谢版主大人哦! 非常感激您! 看来是我代码 错了! 非常感激您的帮助!

作者: yk19880829 发布时间: 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