Zebra_Database是一个高级的、紧缩的(只包含单个文件)、轻量级的、面向对象的MySQL数据库访问封装器,基于PHP的 MySQL扩展开发。提供了各种用于与MySQL数据库交互的直观方法,比PHP自带的更有趣。
示例代码:
debug=true;$db->connect('host','username','password','database');//codegoeshere//thisshouldalwaysbepresentattheendofyourscripts;//whetheritshouldoutputanythingshouldbecontrolledbythe$debugproperty$db->show_debug_console();//$criteriawillbeescapedandenclosedingraveaccents,andwill//replacethecorresponding?(questionmark)automatically$db->select('column1,column2','table','criteria=?',array($criteria));//afterthis,oneofthe"fetch"methodscanberun://tofetchallrecordstooneassociativearray$records=$db->fetch_assoc_all();//orfetchrecordsonebyone,asassociativearrayswhile($row=$db->fetch_assoc()){//dostuff}$db->insert('table',array('column1'=>$value1,'column2'=>$value2,));?>
评论