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
14
votes
1 answer

Why should I use Doctrine over Zend_Db?

I use Zend_Db in some project, I discover Doctrine there is a while but never actually used it. What are the advantage of Doctrine over Zend_Db ? What are the benefits to use Doctrine ? By the way, is it easy to use Doctrine with Zend Framework…
John
  • 181
  • 1
  • 6
13
votes
4 answers

Zend Framework: How to retrieve the id of the last inserted row?

I'm inserting a new row into my database with this code: $data = array( 'key' => 'value' ); $this->getDbTable()->insert($data); How can I get the row id of the this row that I just created?
Andrew
  • 227,796
  • 193
  • 515
  • 708
12
votes
2 answers

Best way to set charset for Zend_Db (or at least better than what I'm currently doing)

I'm using Zend_DB and trying to change the charset to utf8, here is the code: config.ini : [development] db.host = "localhost" db.username = "root" db.password = "toor" db.dbname = "db_whoopdiedo" db.charset = "utf8" bootstrap.php : class Bootstrap…
Hannes
  • 8,147
  • 4
  • 33
  • 51
12
votes
3 answers

Zend-framework DB: OR instead of AND operator

have such zend query: $select = $this->_table ->select() ->where('title LIKE ?', '%'.$searchWord.'%') ->where('description LIKE ?', '%'.$searchWord.'%') ->where('verified=1 AND…
Bounce
  • 2,066
  • 6
  • 34
  • 65
12
votes
4 answers

How do I add complex where clause to Zend Table Select?

I searched the Web and could not find anything that would show me a good solid example. My question is basically this: How do I convert this: SELECT * FROM table WHERE ((a = 1 AND b = 2) OR (c = 3 OR c = 4)) AND d = 5; To Zend syntax similar to…
AD.
  • 237
  • 2
  • 3
  • 12
11
votes
1 answer

How to connect to DB, when running via command line

When I run zend framework project from browser, everything is OK, it connects to DB. When I run project from command line it can't connect to DB and it throws an error: Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000]…
hhs
  • 716
  • 1
  • 6
  • 22
11
votes
5 answers

How to get Column Name With Zend DB

How to get Column Name With Zend DB
monkey_boys
  • 7,108
  • 22
  • 58
  • 82
11
votes
3 answers

Zend DB Selecting constants - columns that do not exist in table

I'm trying to do this query using Zend DB select but I'm not able to do so This is the sql query select shopping_id,shopping_details,"friend" as type from shopping Notice here how I'm specifying "friend" as type and friend is not a column in the…
Gublooo
  • 2,550
  • 8
  • 54
  • 91
11
votes
1 answer

Selecting arbitrary strings with Zend DB Select?

I am using the fluent interface to create a Zend DB Select object/query. As part of the query, I would like to select an arbitrary string, like "SELECT 'foo' AS 'type' FROM ...". foo is not a column, it's just a string literal. When I select an…
wizzard
  • 472
  • 1
  • 4
  • 13
11
votes
5 answers

connecting to two different databases with Zend Framework

I have here a medium sized intranet site which is written entirely in Zend FW. The database for the intranet is located on another server. Now I need to extend the intranet with some new functionality. In order to do this I need to connect to…
Raffael Luthiger
  • 2,191
  • 3
  • 19
  • 31
11
votes
5 answers

MySql driver not installed error for Zend application

I am trying to get my ZEND application up on my apache server running on UNIX. Initially my host didnot give PDO support ,and i got it enabled by requesting them with a mail.But now I am getting an error saying The mysql driver is not currently…
Arc
  • 1,680
  • 6
  • 30
  • 57
10
votes
7 answers

Zend Form Edit and Zend_Validate_Db_NoRecordExists

I am slowly building up my Zend skills by building some utility websites for my own use. I have been using Zend Forms and Form validation and so far have been happy that I have been understanding the Zend way of doing things. However I am a bit…
Peter M
  • 7,309
  • 3
  • 50
  • 91
10
votes
2 answers

Zend_Db: fetchAll() or query()/fetch() for a huge number of records

Assuming I have $db is an instance of Zend_Db_Adapter_Abstract and $sql = 'SELECT blah blah FROM table' will return a huge number of records. There are two code fragments to process the returned data as follows. // Code fragment 1 (let's call it…
peidiam
  • 207
  • 1
  • 3
  • 8
9
votes
4 answers

Learning Zend Framework after Magento: Models

I have been working over an year with Magento and have learned it good enough. Now I want to learn Zend, and I'm stuck with models. I'm used to have entities and collection of entities in Magento, and it's likely that I'll want to use Zend_Db_Table,…
s3v3n
  • 8,203
  • 5
  • 42
  • 56
9
votes
1 answer

Doctrine 2 and Zend 1.11 convert-mapping error..

I have a complex database design with views, relationship etc. We decided to switch to ORM from the standard Zend_db. I successfully integrated zend 1.11 and doctrine 2.1. All the tutorials out there explains about creating the entire database…
Karthik
  • 1,091
  • 1
  • 13
  • 36
1
2
3
72 73