日期:2014-05-17  浏览次数:20441 次

php总是报错,大家帮我看下代码
<?php require_once('../Connections/test.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;
}
}

mysql_select_db($database_test, $test);
$query_test = "SELECT * FROM test";
$test = mysql_query($query_test, $test) or die(mysql_error());
$row_test = mysql_fetch_assoc($test);
$totalRows_test = mysql_num_rows($test);
?>
<form id="form1" name="form1" method="POST">
  <p>
  <label for="id">id</label>
  <input type="text" name="id" id="id" />
  </p>
  <p>
  <label for="name">name</label>
  <input type="text" name="name" id="name" />
  </p>
  <p>
  <label for="pass">pass</label>
  <input type="text" name="pass" id="pass" />
  </p>
  <p>
  <input type="submit" name="anniu" id="anniu" value="提交" />
  </p>
</form>

<p>&nbsp;</p>
<table width="100%" border="1">
  <tr>
  <td>id</td>
  <td>name</td>
  <td>pass</td>
  </tr>
  <? $result1 = mysql_query("SELECT * FROM test where id < 3 order by id ASC ");  
  while($row1=mysql_fetch_array($result1))
  {
$id=trim($row1[id]);
$name=trim($row1[name]);
$pass=trim($row1[pass]);
  echo
  "
  <tr>
<td>$id</td>
  <td>$name</td>
  <td>$pass</td>
  </tr>
  ";
  }
  
  ?>
</table>
<p>&nbsp; </p>
<?php
mysql_free_result($test);
?>[code=PHP][/code]
=============================
报错:
Notice: Use of undefined constant id - assumed 'id' in D:\xampp\htdocs\vest\index.php on line 68

Notice: Use of undefined constant name - assumed 'name' in D:\xampp\htdocs\vest\index.php on line 69

Notice: Use of unde