Questions tagged [zend-db]

Database access component for the Zend Framework.

for PHP 5 includes a database access component, referred to as Zend\Db.

The Zend\Db component includes features such as:

  • Database connection factory class.
  • Adapter for multiple brands of database, closely matching the interface, and also supporting other non-PDO database interfaces such as mysqli and oci.
  • Simple query builder for generic SELECT syntax.
  • statement profiler and logger.
  • Table Data Gateway and Row Data Gateway classes. Together these are similar to the popular Active Record pattern.

Resources:

  1. Github repository
1092 questions
0
votes
2 answers

Simple Zend Db function returning fatal error "Call to a member function toArray() on a non-object"

In my model I have the following function protected $_users ='users'; public function getbyid($user_id) { $select = $this->_db ->select() ->from($this->_users) ->where('users.user_id =?', $user_id); $result =…
Barry Hamilton
  • 943
  • 3
  • 15
  • 35
0
votes
0 answers

Zend Framework 2 - Doctrine - Timestamp Annotation not working

I've got the following problem: I need a created_at field. I thought I solved the problem as follows: /** * @Version @ORM\Column(type="datetime") * @Form\Attributes({"type":"text"}) * @Form\Options({"label":"Created at"}) * @Form\Exclude() * …
Ron
  • 22,128
  • 31
  • 108
  • 206
0
votes
0 answers

zend db returns junk when called from controller but when result dumped in the model it is fine

Weird problem I have the following model in which if I call getSystemgoals() from a controller all is well and array of results are returned. Whenever I call getSystemactivities() what appears to be returned is the entire model zend object (see…
Barry Hamilton
  • 943
  • 3
  • 15
  • 35
0
votes
1 answer

Zend Framework 2 - How to access DB adapter in controller

Despite several hits on Google I still couldn't find out how to access the db adapter I configured in my global.php in any controller. I found this: $db = $this->getParam('bootstrap')->getPluginResource('db')->getDbAdapter(); But it's giving me a…
Ron
  • 22,128
  • 31
  • 108
  • 206
0
votes
3 answers

What native mysql class should I port to from Zend_Db? ( No PDO or Mysqli )

I'm dealing with a client who has a legacy cPanel account where the php installation was not compiled with PDO nor Mysqli therefore my Zend_Db code is useless since it relies on either of those. What library/class should I go with?
meder omuraliev
  • 183,342
  • 71
  • 393
  • 434
0
votes
1 answer

How to use zend_db_select to update when there is two clause

I want to update an entry in the table when 2 conditions are met. I have this statement, but it is only for one where condition $this->dbo->update('mytable', $data, $this->dbo->quoteInto('id= ?', $id)); Instead of just checking where for just "id",…
Slay
  • 1,285
  • 4
  • 20
  • 44
0
votes
3 answers

How to log database errors in zend framework

I am using zend framework 1.12 for my project. I want to catch all types of fatal errors and send them to an email address for quick fix. I have written the below mentioned code in Bootstrap.php file for this purpose. protected function…
Debashis
  • 566
  • 2
  • 14
  • 34
0
votes
1 answer

Update multiple row in Zend

I am trying to figure out how to update multiple row in one update() in zend framework. I have an array of IDs named ids and I would like to update one field of all the rows of these ids. I tried to create a where condition like that : $where =…
Olivier
  • 3,121
  • 2
  • 20
  • 28
0
votes
2 answers

Zend_DB subselect / subquery how to?

I have this raw sql statement which I am trying to execute through Zend_DB. $sql = 'SELECT relocationaction.id, relocationaction.vehicle, relocationaction.start, relocationaction.end, relocationaction.return ' . 'FROM…
Jesse
  • 4,323
  • 3
  • 17
  • 16
0
votes
1 answer

Parameterizing MySQL queries IN clause

I am using Zend's convenience methods for DB calls fetchAll. This, as the knowledgeable ones should know is a function that allows parameterization of queries. For instance, the query could be: $query = "select * from user where email = ?" $results…
Parijat Kalia
  • 4,929
  • 10
  • 50
  • 77
0
votes
1 answer

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

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…
Corné Guijt
  • 122
  • 1
  • 11
0
votes
2 answers

zend_db query on connect

I want the query 'SET NAMES utf8' to execute before any other queries. But, if I execute it in the beginning of my app, it forces Zend_Db to connect to the Database, even if I'm not running any other queries. It isn't cool: My app processes lots of…
Valentin Golev
  • 9,965
  • 10
  • 60
  • 84
0
votes
1 answer

Saving Model to multiple tables

maybe on of you can help my with a little problem im dealing with right now. I have a simple form with: Loginname, Loginpassword, Name, Firstname, Age. Now i want to save these information in two different tables. Users and UserInfo. I have a model…
phil
  • 137
  • 12
0
votes
1 answer

Accessing remote server using Zend_Db_Table

My current system is using Zend Framework 1, and works very well with our local MySQL server. However, I now need to access another server for importing/exporting. I'm using a class extended from zend_db_table_abstract in order to query the…
TheMonarch
  • 577
  • 1
  • 5
  • 19
0
votes
2 answers

How to apply OR operator in zend2 select query

I am so far able to apply AND and LIKE in zend2 SELECT query, but cannot figure out how to apply OR operator. This is my query: $this->table = $data['table']; $select = new Select(); $spec = function (Where $where) { …
Neelam Gahlyan
  • 366
  • 1
  • 3
  • 12