zend-db

Zend_Db: Prepared statement not processing parameters

I am using Zend_Db with the Pdo_Mysql driver. This query does not give any results: $s = $db->prepare('SELECT ET.id FROM elementTypes AS ET, language AS L1 WHERE L1.strId = ET.dispName AND L1.language = ?'); $s->execute(array(2)); pr($s->fetchAll()); If...

Zend_Auth_Adapter_DbTable UTF-8

Here is how I am getting an identity from a database: $adapter = new Zend_Auth_Adapter_DbTable(Zend_Registry::get('dbAdapter')); $adapter->setTableName('clients'); $adapter->setIdentityColumn('email'); $adapter->setCredentialColumn('password_hash'); // etc $client = $adapter->getResultRowObject(null, array('password_hash')); Zend_Sessi...

problems using Zend_Db when running php as cli script

Hi, I am trying to add some administration scripts to a Zend Framework project, that will end up being run nightly via cron. However I've hit my first problem with the script when trying to use Zend_Db. I am currently doing a very simple SQL call to get some results and just display them using var_dump() however I get the following e...

How do i assign a custom helper to each view differently in zend framework

i have a custom helper written which returns the html form as string which extends the Zend_view-hepler_Abstract Now i have 3 helpers .How do i assign each helper to a different view . It is something like this in the controller class abc extends Zend_controller_front{ public action page1Action (){ // I want to use a different Help...

Stop Zend_Db from quoting Sybase BIT datatype field values

I'm using Pdo_Mssql adapter against a Sybase database and working around issues encountered. One pesky issue remaining is Zend_Db's instance on quoting BIT field values. When running the following for an insert: $row = $this->createRow(); ... $row->MyBitField = $data['MyBitField']; ... $row->save(); FreeTDS log output shows: dbutil.c:...

$_referenceMap Relationships with Zend_Db_Table_Abstract creates too many queries

This is my first time using Zend Framework for an application and i don't know if I completely have by head around Models. I have four tables: shopping_cart, product, product_unit, distributor. shopping cart has an cart_id, product_id, unit_id and dist_id (shopping cart joins on the other tables with their corresponding id). Before Zen...

Error while joining tables with Zend_Db

Why am I getting this: An error occurred Application error Exception information: Message: Select query cannot join with another table while trying to join two tables? I have this line code inside my model which extends Zend_Db_Table_Abstract public function getProjects() { $select = $this->select() ->from(array('...

How to define relationships in Zend Framework

I have two simple tables: Projects and SubProjects which I'd like to print every subproject with the respective project in a table. So I wrote this: class Admin_Model_Projects extends Zend_Db_Table_Abstract { protected $_name = 'main_projects'; protected $_primary = 'mai_id'; protected $_sequence = true; protected $_dep...

Zend Db joinLeft with parameterized value

I need to joinLeft within Zend_Db ala: $select->joinLeft(array('ATAG' => 'ad_tags'), array('ADM.id = ATAG.ad_id AND ADM.site_id = ATAG.site_id AND ATAG.tag_id = ?', $input_vars['tag']), array('tag_id')) ->order('ATAG.tag_id DESC') ->limit('1'); However, I can't use an array as the seco...

Multiple Databases with Zend

Hey there, I'm building an application (using the zend framework) where we will have multiple clients who login and use the application, and each of these clients will be storing lots of data about their users (I'm using MySQL btw). Basically I'm wondering 2 things: Is having multiple databases, one for each client (ie. ipd_client_CL...

Zend db cascade delete multiple levels

How does one make Zend Db cascade delete multiple levels of the hierarchy? For example: dealers -> products -> attributes deleting one dealer should go all the way down to attributes, and now it doesn't :( Any thoughts? ...

Mixing Zend_Db with ORM Classes

Zend has Zend_Db but it's not a full ORM. I already have sections of an app written in a way that uses Zend_Db. I do however want to integrate a full ORM into the application to use it for more complex database operations, but I don't want to have to re-write existing actions that are complete. Those more experienced with Zend Framework...

Zend db adapter mysqli or PDO_MYSQL

I've seen several code samples that do this in application.ini resources.db.adapter = mysqli or resources.db.adapter = PDO_MYSQL What is the real difference between the two? Does it impact my code? when should I choose one or the other? ...

PHP implode array to generate mysql IN criteria

I have a function like the following: public function foo ($cities = array('anaheim', 'baker', 'colfax') ) { $db = global instance of Zend_Db_Adapter_Pdo_Mysql... $query = 'SELECT name FROM user WHERE city IN ('.implode(',',$cities).')'; $result = $db->fetchAll( $query ); } This works out fine until someone passes $cities...

Zend Db Float Problem

Hello, I have a MySQL table structured: float(10,2) For example I insert a row. $value = array('price' => '13539.51'); $db->insert($value); When I check this row with phpmyadmin, everything is fine. But when I read this row with Zend Db, price value like this "13539.509765625". How can i fix this problem. $select = $db->select(); $...

Where should I implement cache within Zend_Db ?

Hi, I'm looking to implement a cache within Zend_Db, there isn't any native method to provide a cache to Zend_Db, so I'm wondering where should I do it. I took a look to the Zend_Db_Table_Abstract (I'm extending it in a custom App_Model_DbTable_Abstract) and I found a protected method _fetch() which directly take a Zend_Db_Table_Select...

Zend Framework Complex Where Statement

This method is published as offical example ->where("price < $minimumPrice OR price > $maximumPrice") is such method safe? want to write it as ->where("price < ? OR price > ?", $minimumPrice, $maximumPrice) are there any poissibility? and I can't split it into 2 where statements because plan to write query ->where("1 OR 2") ->where(...

Force Zend Framework to connect to database earlier than usual

I am trying to store custom routes for the Zend Framework inside the database. I have the process down that will create the route, but the problem I am running into is that when I am adding the routes it looks like Zend has not yet created its connection to the database. Does anyone know where this processes initially happens or how I c...

Dynamic Database Connections with Zend

The result I'm trying to achieve involves having an application with a database with minimal tables that store data regarding users on the system, this database would be used to verify user's login details when they login to the application. What I want to be able to do is to dynamically connect to another database once the user has logg...

Zend_Db, how to work with related tables?

I want to learn to work with related tables in the ZF to the end. (1) Can anyone help with this? there are 2 users table and *users_openid* with a link to many. I would like to implement a relationship between the tables at Zend_Db so that such users from taking it openid on Drugs findDependentRowset, add openid, openid to take the user...