php总是报错,大家帮小弟我看下代码
程序员文章站
2022-04-07 22:17:52
...
php总是报错,大家帮我看下代码
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION $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);
?>
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 undefined constant pass - assumed 'pass' in D:\xampp\htdocs\vest\index.php on line 70
68、69、70这三行是
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION $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);
?>
id | name | pass |
$id | $name | $pass |
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 undefined constant pass - assumed 'pass' in D:\xampp\htdocs\vest\index.php on line 70
68、69、70这三行是
相关文章
相关视频
上一篇: php 支持中文字符串分割的函数实例详解
推荐阅读
-
[^a-zA-Z0-9u4e00-u9fa5s]小弟我用这个匹配符号,php 中preg_replace总是报错,如何破
-
大家帮小弟我看下这段代码中的“%”是什么意思
-
麻烦大家帮小弟我看下这句代码
-
为什么 小弟我写的删除功能如何总是提示删除失败?为题出在什么地方 希望大家帮忙 代码如下
-
大家帮小弟我看下这段代码中的“%”是什么意思
-
PHP实在让人头痛,看不懂啊被老大叼得不行了,大家帮小弟我看段团购网的代码是什么
-
大家帮小弟我看下这段代码中的“%”是什么意思
-
php总是报错,大家帮小弟我看下代码
-
PHP实在让人头痛,看不懂啊被老大叼得不行了,大家帮小弟我看段团购网的代码是什么
-
JS里面嵌入php代码,JS语法异常了,请大家帮小弟我看看