zend-db

Can we lock tables while executing a query in Zend-Db

ぐ巨炮叔叔 提交于 2020-02-23 04:35:06
问题 I am talking about doing something like this: LOCK TABLE page WRITE; SELECT * FROM page WHERE col = 'value'; INSERT INTO page(col1, col2) VALUES('val1', val2); UNLOCK TABLES; 回答1: I don't see an actual Zend DB method to lock tables, but maybe just do this: //Lock Table $sql = "LOCK TABLE page WRITE"; $db->fetchRow($sql); //Get your data $sql = "SELECT * FROM page WHERE col='value'"; $result = $db->fetchAll($sql); //Make the insert $data = array( 'col1' => 'val1', 'col2' => 'val2' ); $db-

zend relationships with select

为君一笑 提交于 2020-01-21 05:20:11
问题 I am new to zend. I have been asked to redevelop a website that was once written in plain PHP and put it into the zend framework. I am having a lot of trouble with database relationships, I cant seem to get my head round defining and querying relationships. I would like to find a Category. From that Category I would like to be able to find all the CategoryInfo associated with it, and be able to query/sort/limit that dataset. Here are my models. Categorys.php <?php class Default_Model

Can't connect to external database with Zend Framework but mysql_connect works

佐手、 提交于 2020-01-17 06:57:31
问题 I am trying to connect to multiple databases with Zend Framework. When I connect using the same credentials with mysql_connect, it works just fine. When I connect with Zend I get "Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[28000] [1045] Access denied for user 'xxxx'@'localhost' (using password: YES)' in C:\wamp\www\zend\library\Zend\Db\Adapter\Pdo\Abstract.php on line 144" I was following the tutorial at http://www.amazium.com/blog/using-different-databases-with

Can't connect to external database with Zend Framework but mysql_connect works

雨燕双飞 提交于 2020-01-17 06:57:21
问题 I am trying to connect to multiple databases with Zend Framework. When I connect using the same credentials with mysql_connect, it works just fine. When I connect with Zend I get "Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[28000] [1045] Access denied for user 'xxxx'@'localhost' (using password: YES)' in C:\wamp\www\zend\library\Zend\Db\Adapter\Pdo\Abstract.php on line 144" I was following the tutorial at http://www.amazium.com/blog/using-different-databases-with

ZF2 Zend\Db Insert/Update Using Mysql Expression (Zend\Db\Sql\Expression?)

◇◆丶佛笑我妖孽 提交于 2020-01-14 07:48:10
问题 Is there any way to include MySQL expressions like NOW() in the current build of ZF2 (2.0.0beta4) through Zend\Db and/or TableGateway insert()/update() statements? Here is a related post on the mailing list, though it hasn't been answered: http://zend-framework-community.634137.n4.nabble.com/Zend-Db-Expr-and-Transactions-in-ZF2-Db-td4472944.html It appears that ZF1 used something like: $data = array( 'update_time' => new \Zend\Db\Expr("NOW()") ); And after looking through Zend\Db\Sql

Zend Framework: How to find a table row by the value of a specified column?

此生再无相见时 提交于 2020-01-13 11:59:10
问题 I am implementing my model exactly like the quickstart guide. In my model I am trying to implement a findByToken() method. The current find() method accepts an $id parameter, but I want to find by the value of a different column. //excerpt from the quickstart guide public function find($id, Default_Model_Guestbook $guestbook) { $result = $this->getDbTable()->find($id); if (0 == count($result)) { return; } $row = $result->current(); $guestbook->setId($row->id) ->setEmail($row->email) -

MySQL remove space before order by clause

a 夏天 提交于 2020-01-13 11:28:10
问题 I have a table full of "title" that I want to order by title. Problem is a lot of them have a empty space before the title. I am thinking of writting a php script to fix it all (super easy) but I was curious how could I do: SELECT * FROM products ORDER BY title But at the same time trimming the title so it doesnt order on the empty space. All in the same query without changing the data. God I hope I make sense. So I am really looking for a mysql solution to this. For what its worth I use Zend

[zend][db] fetchAll with multiple variables

岁酱吖の 提交于 2020-01-13 10:04:49
问题 I'm trying to use fetchAll on a query that has 2 variables. I can't figure out the syntax. I can manage with only 1 variable: $sql = "SELECT * FROM mytable WHERE field1 = ?"; $this->_db->fetchAll($sql,$value1); # that works However I'm having some issues when query has multiple variables $sql = "SELECT * FROM mytable WHERE field1 = ? AND field2 = ?"; $this->_db->fetchAll($sql,$value1,$value2); # doesn't work $this->_db->fetchAll($sql,array("field1"=>$value1,"field2"=>$value2)); # doesn't work

Missing /Zend/Db/Adapter/Pdo/Mysql.php

ⅰ亾dé卋堺 提交于 2020-01-06 09:30:14
问题 So after some long struggling I finaly have the ZendFramework running. Now I'm trying to get it working with my database, but my error file is telling me the following: PHP Warning: include_once(Zend/Db/Adapter/Pdo/Mysql.php): failed to open stream: No such file or directory ..... When I run # ls /usr/share/php/Zend/Db/Adapter/Pdo the only response I'm getting is: Abstract.php Sqlite.php # rpm -qa | grep php is returning this: php-ZendFramework-1.12.3-1.el6.remi.noarch php-xml-5.5.0-0.28

Why zend_form cannot populate inputs with records from Firebird db with diacritic characters?

ぐ巨炮叔叔 提交于 2020-01-06 05:49:10
问题 I have zend application connected to Firebird database via ZendX library. It has windows-1250 charset. I am trying to use zend_form to create edit form and populate it with db values. It works with records free of diacritic characters and data is displayed properly, it's editable. Problem occurs whenever there are special characters, and form inputs are empty. $form->addElement( 'textarea', 'POD', array( 'value' => $this->ksiega['POD'], 'attribs' => array( 'class' => 'pod'), ) ); $form-