错误提示:
Fatal error: Call to undefined function queryMysql() in E:\xampp\htdocs\business\include\days_mgmt.php on line 7
代码:<?php
if(isset($_POST['btn_add'])&&$_POST['btn_add']=="Add Day")
{
$day=$_POST['txt_day'];
$day_no=$_POST['txt_day_no'];
$query="INSERT INTO TRADING_DAYS_CONTAINER (days_no, days) VALUES ('$day_no', '$day')";
$result=queryMysql($query); //这里的queryMysql()就是mysql_query()
if($result)
{
header("Location:admin_trading.php?class=days_mgmt");
}
}
?>我没有自己配置php mysql环境,是下载的XAMPP。
关键是,我都写了好几个月了,一直这么写的,都没出现这个问题,应该不是配置问题吧!
queryMysql()是lib/function.php里面的,我在开头也include了。搞死了,这是怎么回事????大大们!
Fatal error: Call to undefined function queryMysql() in E:\xampp\htdocs\business\include\days_mgmt.php on line 7
代码:<?php
if(isset($_POST['btn_add'])&&$_POST['btn_add']=="Add Day")
{
$day=$_POST['txt_day'];
$day_no=$_POST['txt_day_no'];
$query="INSERT INTO TRADING_DAYS_CONTAINER (days_no, days) VALUES ('$day_no', '$day')";
$result=queryMysql($query); //这里的queryMysql()就是mysql_query()
if($result)
{
header("Location:admin_trading.php?class=days_mgmt");
}
}
?>我没有自己配置php mysql环境,是下载的XAMPP。
关键是,我都写了好几个月了,一直这么写的,都没出现这个问题,应该不是配置问题吧!
queryMysql()是lib/function.php里面的,我在开头也include了。搞死了,这是怎么回事????大大们!
至少在你贴出的代码中没有看到 include 字样2、由于莫种原因,定义 queryMysql 函数损坏了,导致 queryMysql 函数定义失败
这也是可能的3、我都写了好几个月了,一直这么写的,都没出现这个问题
那么你以前写的程序也出现这个问题吗?
2.如果损坏的话,那其他页面的queryMysql()应该也不能用吧?但是其他页面都好好的,这个fatal error今天突然出现的。
3.以前写的所有页面均没出现这种问题。
该是什么原因?
<?php 后
$result=queryMysql($query); 前
加一句 print_r(get_included_files()); 看看 lib/function.php 是否在其中
你是否最近有什么配置上的更改? 或其它方面的更改呢?
我以前在php-5.3.* + APC上出现过这种问题,明明写了include,但却报没有定义。那是因为APC只适和<=5.2.*
lib/function.php没有包括在里面,框架代码里所有include都没包括在里面。
这是为什么?
在框架代码里面include别的php页面,不用在那个页面再include一遍吧??我最近没有改过配置什么。
后来我在上面代码的那个页面又include一遍所有files,好像可以了。
但是为什么啊?假如在1.php里面include 2.php,不是只要在1.php里面include一次就可以了嘛?
为啥现在要在2.php还要include一遍呢???
我现在就是这个情况
<?php
// filename: 1.php// 这样没问题
include 'other.php';
include '2.php';// 这样2.php中的脚本就要报未定义了,因为还没执行到include 'other.php'
include '2.php';
include 'other.php';
?>
我是这种:
<?php//框架代码, 1.phpinclude 'lib/functions.php';
include '2.php';?>然后在2.php里面检测不到lib/function.php
你最好贴出 print_r(get_included_files()); 的结果
必要时,要按你的理解逐次 print_r(get_included_files());看看问题出在什么地方
你不是还有不出错的应用吗?对比一下,应该就清楚了
你说的对
这是print结果: Array ( [0] => E:\xampp\htdocs\business\include\days_mgmt.php )
正常的是:Array (
[0] => E:\xampp\htdocs\business\admin_trading.php
[1] => E:\xampp\htdocs\business\lib\functions.php
[2] => E:\xampp\htdocs\business\lib\connect_to_db.php
[3] => E:\xampp\htdocs\business\include\header.htm
[4] => E:\xampp\htdocs\business\include\account_bar.php )我先对比看看吧 先谢谢了!