Home  >  Article  >  Backend Development  >  Zend Framework中insert时是组合的?小弟我的sql一直有有关问题。supportsParameters是什么意思

Zend Framework中insert时是组合的?小弟我的sql一直有有关问题。supportsParameters是什么意思

WBOY
WBOYOriginal
2016-06-13 13:35:56893browse

Zend Framework中insert时是组合的?我的sql一直有问题。supportsParameters是什么意思?
我在Controller中:
$table = new Model_Users();
$dd = array('username'=>$username,'password'=>md5($password),'name'=>$name,'email'=>$email,
  'reg_time'=>date("Y-m-d H:m:s",time()),'ipaddr'=>$_SERVER['REMOTE_ADDR']);
$test = $table->insert($dd);
然后一直有错误,我跟踪后发现在zend_db_adapter_abstract 中的public function insert($table, array $bind) 中我的sql
在$this->supportsParameters('positional') 时全部把表中的值设为了“?”,请问这个函数的意思是什么?
是不是数据库的配置的问题?
代码:zend_db_adapter_abstract 中549cell.


------解决方案--------------------
你先查看 $this->supportsParameters('positional') 返回的值
最好贴出了来

再检查你准备赋值的变量是否与 ? 个数一致,赋值时的变量名是否与对应的字段名一致
------解决方案--------------------
1.根据你的Db Adapter, ZendDB有可能是调用了mysqli 或者 pdo mysql, 这两个扩展里都有bind操作的函数,然后代码就运行到了该函数的c部分啊
2.不是error-log,是mysql的log, 一般来说my.cnf里可能没有开启, 
参看这里: http://www.howtogeek.com/howto/database/monitor-all-sql-queries-in-mysql/

探讨

楼上,谢谢,顺利解决,通过try catch,这里有两个问题不太明白,望指教!
1. 这里是怎么条用底层的c的?可有简单的例子?
2. 我去mysql中找log,show error-log,但我这里好像什么都看不见?

谢谢!
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn