+ -
当前位置:首页 → 问答吧 → IF语句判断代码!  急  急  急在次求高手指点!

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) {echo " VIP帐户";} else { echo "会员帐户";}?> </td>


按照版主大人的写法  我测试了!  是显示了!  可是不管 and 字段的值是0  还是1  他前台就只显示普通会员一个!      and字段我设置的是  int   默认值是0    请问到底是那里的问题呢!   很郁闷呐


作者: yk19880829   发布时间: 2010-10-06

<?php if ($row_Recordset1['and']=0) {echo " VIP帐户";} else { echo "会员帐户";}?>
注意 ‘=’ 和 ‘==’ 的区别  一个赋值  一个是判断

作者: kingsoul   发布时间: 2010-10-07