首页 Soft PlugIn RAN乱 Dev开发 Info资料 English WAP 留言 登陆 注册
-
Posted by Yippee | 评论(0) | 引用(0) | 阅读2489次
PHP MYSQL 通用数据处理 error_reporting select onchange

如果你要把错误讯息记录下来,你可以定义两个选择性常数 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>


字体:

Permanant URI永久地址 http://www.shengfang.org/blog/p/phptydataselectonchange.php
Trackback URI引用地址 http://www.shengfang.org/blog/tb.php?tb_id=1130208912

2005年10月25日10:55星期二  [Dev开发] 追踪此文的RSS
提示:
此文还没有评论。

称呼:    登陆   注册
   不注册,但记住我的信息
邮件:
(非必须)
评论: [UBB代码帮助]
粗体 斜体 下划线 链接 水平线 引用



验证码: 请输入你看见的数字
关闭UBB      提交时自动将内容复制到剪贴板

公告
Fire and Motion!

统计信息
[Yippee]||[统计]||日志:1790
在线: 15||用户: 2563 [列表]
今日:479||到访:2682118
Rss:841888||评论:1585

最新日志

最新评论

友情链接

日历

最新引用

搜索

归档

杂项
Get RSS Feed (Version 2.0)
Get Atom Feed (Version 0.3)
编码:  UTF-8