如果你要把错误讯息记录下来,你可以定义两个选择性常数 ADODB_ERROR_LOG_TYPE, ADODB_ERROR_LOG_DEST。有关於 ADODB_ERROR_LOG_TYPE 的值,你可以去叁考 PHP 使用手册中有关於 error_log 的说明。在以下的范例中,我使将它设为 3,意思是指将讯息记录到常数 ADODB_ERROR_LOG_DEST 所设定的档案中。 <?php error_reporting(0); # 不显示任何的错误讯息 define('ADODB_ERROR_LOG_TYPE',3); define('ADODB_ERROR_LOG_DEST','C:/errors.log'); include('ADOdb-errorhandler.inc.php'); include('ADOdb.inc.php'); include('tohtml.inc.php'); $c = NewADOConnection('mysql'); $c->PConnect('localhost','root','','northwind'); $rs=$c->Execute('select * from productsz'); ## 不正确的资料表 productsz if ($rs) $rs2html($rs); ?> 以下则是写在 error.log 档的错误讯息: (2001-10-28 14:20:38) mysql error: [1146: Table 'northwind.productsz' doesn't exist] in EXECUTE("select * from productsz") error_reporting (PHP 3, PHP 4, PHP 5) error_reporting -- Sets which PHP errors are reported 说明 int error_reporting ( [int level] ) The error_reporting() function sets the error_reporting directive at runtime. PHP has many levels of errors, using this function sets that level for the duration (runtime) of your script. 不过很奇怪,如果设置该项,根本没有任何出错信息,页面没有显示。LOG文件也没有记录 <select name="sfsf" onChange="javascript:show()"> <option value="0">管理员</option> <option value="1" selected>操作员</option> </select> 我们用Select的onchange事件时,常会遇到这样一个问题,那就是连续选相同一项时,不触发onchange事件.select的onchange事件就是这样子的.你得有Change(改变),才能触发该事件.... 掌握了它的特性后,相应的解决办法也很简单. <select name=sel onchange="bao(this.options[this.options.selectedIndex].value)"> <option value="">请选择 <option value="1">Item 1 <option value="2">Item 2 <option value="3">Item 3 </select> <script> function bao(s) { txt.value+=s; //选择后,让第一项被选中,这样,就有Change啦. document.all.sel.options[0].selected=true; } </script> <textarea id=txt></textarea> 在PHP中得到多选的下拉菜单的各项值 <html> <head> <title>www.shengfang.org</title></head><body> <?php if($submit) { for($i=0;$i<count($select);$i++) echo $select[$i]; ?> <form name="form1" method="post" action=""> <select name="select[]" size="6" multiple> <option value="1" selected>www.shengfang.org</option> <option value="2">www.shengfang.org</option> </select> <input type="submit" name="submit" value="Submit"> </form> </body> </html> 字体:大 中 小 |