错误信息提示:
Warning: include( drawDataGrid.class.php ) [function.include]: failed to open stream: No such file or directory in E:\essamp\wwwroot\Datagrid\demo1.php on line 2在第二行:include (" drawDataGrid.class.php ");
Warning: include() [function.include]: Failed opening ' drawDataGrid.class.php ' for inclusion (include_path='.;C:\php5\pear') in E:\essamp\wwwroot\Datagrid\demo1.php on line 2Warning: mysql_list_fields(): supplied argument is not a valid MySQL-Link resource in E:\essamp\wwwroot\Datagrid\demo1.php on line 68第六十八行:$fields = mysql_list_fields("php","logins","$db_conn");Warning: mysql_num_fields(): supplied argument is not a valid MySQL result resource in E:\essamp\wwwroot\Datagrid\demo1.php on line 70第七十行:$columns = mysql_num_fields ($fields);
Fatal error: Class 'drawDataGrid' not found in E:\essamp\wwwroot\Datagrid\demo1.php on line 184
第一百八十四行:$dgrid = new drawDataGrid;
问题:
1、这都是些什么信息?什么意思啊?
2、存在文件 drawDataGrid.class.php
3、数据库和表都存在
请各位大侠做出解答。谢谢。
Warning: include( drawDataGrid.class.php ) [function.include]: failed to open stream: No such file or directory in E:\essamp\wwwroot\Datagrid\demo1.php on line 2在第二行:include (" drawDataGrid.class.php ");
Warning: include() [function.include]: Failed opening ' drawDataGrid.class.php ' for inclusion (include_path='.;C:\php5\pear') in E:\essamp\wwwroot\Datagrid\demo1.php on line 2Warning: mysql_list_fields(): supplied argument is not a valid MySQL-Link resource in E:\essamp\wwwroot\Datagrid\demo1.php on line 68第六十八行:$fields = mysql_list_fields("php","logins","$db_conn");Warning: mysql_num_fields(): supplied argument is not a valid MySQL result resource in E:\essamp\wwwroot\Datagrid\demo1.php on line 70第七十行:$columns = mysql_num_fields ($fields);
Fatal error: Class 'drawDataGrid' not found in E:\essamp\wwwroot\Datagrid\demo1.php on line 184
第一百八十四行:$dgrid = new drawDataGrid;
问题:
1、这都是些什么信息?什么意思啊?
2、存在文件 drawDataGrid.class.php
3、数据库和表都存在
请各位大侠做出解答。谢谢。
<?php
include("drawDataGrid.class.php");if (isset($_REQUEST[ 'editTbl' ])) //判断是否为编辑记录
{
$editTbl = $_REQUEST[ 'editTbl' ];
}
else
{
$editTbl=0;}
if (isset($_REQUEST[ 'newTbl' ])) //判断是否为插入新记录
{
$newTbl = $_REQUEST[ 'newTbl' ];
}
else
{
$newTbl=0;}
if (isset($_REQUEST[ 'rowNo' ])) //行编号
{
$rowNo = $_REQUEST[ 'rowNo' ];
}
else
{
$rowNo=0;}if (isset($_REQUEST[ 'curpage' ])) //获取当前页
{
$curpage = $_REQUEST[ 'curpage' ];
}
else
{
$curpage=0;}
if ($curpage == 0) //如果当前页为0,则设置为1
{
$curpage = 1;
}
$db_conn=mysql_connect("localhost" , "root" , "123456"); // 连接数据库
mysql_select_db ("php" , $db_conn ); //选择数据库php,需要在实例运行之前创建
$query = " select * from logins"; //从logins表中查询记录
$result = mysql_query ($query,$db_conn); //执行查询
$num_rows = mysql_num_rows ($result); //获取所有记录数量
$rowLower = 0;
$rowUpper = $num_rows;
$colLower=0;
//获取字段信息
$fields = mysql_list_fields("php","logins","$db_conn");
//获取字段数量
$columns = mysql_num_fields ($fields);
$colUpper = $columns + 2 ;
$updateImg = true ; //编辑图像显示
$deleteImg = false;?><html>
<head>
<title> PHP DATAGRID - by Bala </title>
<META NAME="GENERATOR" content=" Microsoft FrontPage 4.0">
<link rel="stylesheet" href="stylesheet.css" type="text/css">
<script>
function cancel() //取消记录编辑、插入
{
document.tmpFrm.rowNo.value = 0;
document.tmpFrm.editTbl.value = 0;
document.tmpFrm.newTbl.value = 0;
document.tmpFrm.submit();
} //end of check
function check(i) //显示编辑记录界面
{
document.tmpFrm.rowNo.value = i;
document.tmpFrm.newTbl.value = 0;
document.tmpFrm.submit() ;
} //end of check
function checkNew(i) //显示插入新记录界面
{
document.tmpFrm.rowNo.value = 0;
document.tmpFrm.editTbl.value = 0;
document.tmpFrm.submit();
} //end of check
function deleteYesNo(i)
{
var ok;
ok = confirm ("Are you sure you want to delete this record?");
if (ok)
{
document.dgridFrm.del.value = i;
val.value=i;
alert( val.value ) ;
document.dgridFrm.action = "delete.php";
document.dgridFrm.submit(); //提交记录删除
} //end if
} //end of deleteYesNo()
function newRecord() //提交新记录
{
if (document.dgridFrm.item(1).value == "")
{
alert ("Please enter User Name!")
document.dgridFrm.item(1).focus();
}//end if
else
{
if(document.dgridFrm.item(2).value == "")
{
alert("Please enter Password!")
document.dgridFrm.item(2).focus();
}//end if
else
{
document.dgridFrm.action = "save.php";
document.dgridFrm.submit();
} //end else
} //end else
} //end of deleteYesNo()</script>
</head>
<body>
<form name="tmpFrm" method="post" >
<input type="hidden" name="editTbl" value="1">
<input type="hidden" name="newTbl" value="1">
<input type="hidden" name="rowNo" >
</form>
<form name="dgridFrm" method="post" action="update.php">
<input type="hidden" name="del" >
<table width="60%" border="0">
<?
if (isset($_POST[' mess ']))
{
?>
<tr>
<td align="center">
<?
echo "<font color=\"red\" face=\"verdana\" >".$_POST['mess']."</font><br>";
?>
</td>
</tr>
<tr>
<td> </td>
</tr>
<?php } ?><tr>
<td align="center">
<?
$tblWidth = 100;
$tblBorder = 0 ;
$title = array (1 => "ID" ,2 => "Password" ,3 => "Email");
$dgrid = new drawDataGrid; //创建类实例$dgrid->TableStart($tblWidth);
$dgrid->RowStart(0);for ($i=0 ; $i <= mysql_num_fields ($result) ; $i++) //显示表头
{
if ($i == 0)
{
$dgrid->mainCellStart(5);
echo "<a href='JavaScript:cancel();'><img src='recycle.gif' border='0' alt='Cancel'></a>";
$dgrid->mainCellEnd();
}
else
{
if (($i == 2)||($i == 3))
{
$dgrid->mainCellStart(0);
echo "<b>".ucfirst(mysql_field_name($result , $i-1))."</b>"; //将字符串第一个字符改大写。
$dgrid->mainCellEnd();
}
else
{
$dgrid->mainCellStart(5);
echo "<b>".ucfirst(mysql_field_name($result , $i-1))."</b>";
$dgrid->mainCellEnd();
}
}
}
$dgrid->mainCellStart(5);
echo " ";
$dgrid->mainCellEnd();
$dgrid->mainCellStart(5);
echo " ";
$dgrid->mainCellEnd();
$dgrid->RowEnd();
//显示表格的具体内容
for ($r = $rowLower ; $r < $rowUpper ; $r++ )
{
$row = mysql_fetch_array ($result) ;
$dgrid->RowStart($r);
for ($c = $colLower ; $c <= $colUpper ; $c++)
{
if ($c == $colLower)
{
$dgrid -> mainCellStart(0);
echo " " ;
$dgrid -> mainCellEnd();
}
else
{
if ($row[0] == $rowNo)
{
if ( $c <= $columns)
{
$dgrid -> CellStart();
echo "<input type='text' name=' ".mysql_field_name($result , $c-1)." ' taborder= '0' value= ' ".trim($row[$c - 1])." '>" ; //显示文本框
$dgrid->CellEnd();
}
else if ($c == $columns+1)
{
$dgrid->CellStart();
echo "<a href='JavaScript:document.dgridFrm.submit();'> <img src='save.gif' border='0' alt='Save'></a>"; //显示保存图像
}
else
{
$dgrid->CellStart();
echo " ";
$dgrid->CellEnd();
}
}
else
if ($c <= $columns)
{
$dgrid->CellStart();
echo trim($row[$c - 1]);
$dgrid->CellEnd();
}
else
if ($c == $columns + 1 )
{
$dgrid->CellStart();
echo "<a href='JavaScript:check(".$row[$c - 4]."); '><img src='edit.gif' border='0' alt='Edit'></a>";//显示编辑图像
$dgrid->CellEnd();
}
else
{
$dgrid->CellStart();
echo "<a href='JavaScript:deleteYesNo(".$row[$c - 5]."); '><img src='delete.gif' border='0' alt='Delete'></a>";//显示编辑图像
$dgrid->CellEnd();
}
}
}
$dgrid->RowEnd();
}
if ($newTbl == 0)
{
$dgrid->RowStart($num_rows);
$dgrid->mainCellStart(0);
echo "<a href=' JavaScript:checkNew( ".($r + 1)." ); '><img src='add.gif' border='0' alt='New Record'> </a>" ; //显示添加新纪录
$dgrid->mainCellEnd();
//echo $colLower." ".$colUpper;
for ($c = $colLower; $c < $colUpper ;$c++)
{
$dgrid->CellStart();
if ($c == $colLower)
echo " ";
else
echo " ";
$dgrid->CellEnd();
}
$dgrid->RowEnd();
}
if ($newTbl == 1)
{
$dgrid->RowStart($num_rows + 1);
$dgrid->mainCellStart(0);
echo " ";
$dgrid->mainCellEnd();
for ($c = $colLower; $c < $colUpper ; $c++)
{
if ($c == 0)
{
$dgrid->CellStart();
mysql_data_seek($result, $num_rows-1); //移动内部结果的指针。
// $row=mysql_fetch_array($result);
$row = mysql_fetch_row($result);
echo $row[0] + 1 ;
$dgrid->CellEnd();
}
else
if ( ($c) < $columns )
{
$dgrid->CellStart();
echo "<input type='text' name= ' ".mysql_field_name($result , $c-1)." ' taborder= '0'>";//显示文本框
$dgrid->CellEnd();
}
else if ($c == $columns)
{
$dgrid->CellStart();
echo "<a href='JavaScript:newRecord();'> <img src='save.gif' border='0' alt='Save'> </a>"; //显示保存图像
$dgrid->CellEnd();
}
else
{
$dgrid->CellStart();
echo " ";
$dgrid->CellEnd();
}
}
$dgrid->RowEnd();
}$dgrid->TableEnd();
?>
</td>
</tr>
</table>
</form>
</body>
</html>
<?php
class drawDataGrid
{
var $headerColor="#FF9966";
var $cellColor="#FFE0C1";
var $borderSize=1;
function TableStart($tblWidth) //输出表格关键字table及属性设置
{
echo "<table id='grdTbl' width=' ".$tblWidth."% ' cellspacing='0' cellpadding='2' border=' ".$this->$borderSize." '
bordercolor='#000000' class='gridtbl' >";
echo chr(13); //chr() 函数从指定的 ASCII 值返回字符,代表回车字符。
}
function TableEnd() //输出表格结束符
{
echo "</table>";
echo chr(13);
}
function RowStart($idVal) //输出表格行结束
{
echo "<tr id='".$idVal."'>";
echo chr(13);
}
function RowEnd()
{
echo "</tr>"
echo chr(13);
}
function mainCellStart($cellWidth) //表格标题单元开始,也就是第一行的表格单元
{
echo "<td class='tdInset' bgcolor=' ".$this->headerColor."' width=' ".$cellWidth." '>";
echo chr(13);
}
function mainCellEnd() //表格标题单元结束
{
echo "</ td>";
echo chr(13);
}
function CellStart() //其它表格单元开始
{
echo "<td bgcolor=' ".$this->cellColor." ' class='tdInset'>";
echo chr(13);
}
function CellEnd() //表格单元结束
{
echo "</ td>";
echo chr(13);
}
}
?>
网站根目录:E:\essamp\wwwroot
demo1.php 与 drawDataGrid.class.php 所在目录:E:\essamp\wwwroot\Datagrid
其实这是一个在线数据编辑模块:所用到的所有文件都在datagrid目录下。
值得一提的是把Datagrid目录删了,直接将drawDataGrid.class.php和 demo1.php 等文件放在
E:\essamp\wwwroot\ 网站根目录下则可以正常显示。
if(!@function_exists(page)){}在类文件的开头加上这样一句看行不
多多php的多重包含。