Tables in my database are created with a correct UTF-8 charset like this:
CREATE TABLE users (
id INT NOT NULL AUTO_INCREMENT,
...
...
...
...
...
PRIMARY KEY (id)
) ENGINE = INNODB CHARACTER SET utf8 COLLATE utf8_slovak_ci;
However, when I use Zend_Db_Table to fetch the data from the table with this method:
public function getSingl...
Hello, i am thinking of using Zend_Auth as the Authentication "mechanism" (component) for a web site. After a quick look a realized that for Database Table Authentication i will also have to use the Zend_Db component.
Has anyone tried this approach? Am i forced to use and/or extend/implement the Zend_DB methods/interfaces in order to ha...
Hello,
How would I test my mappers in Zend_Db?
Each of my model will have 3 classes:
The Model
The Mapper
The DbTable
Here is my Unit Test:
<?php
// Call Model_BugTest::main() if this source file is executed directly.
if (!defined("PHPUnit_MAIN_METHOD")) {
define("PHPUnit_MAIN_METHOD", "Model_ArtistTest::main");
}
require_once...
I'm selecting records from a database using the equivalent of this query:
SELECT * FROM reports WHERE user_id IN (3, 6, 22);
The function calling fetchAll() has an argument that's an array of the user IDs, and this call works just fine:
$resultSet = $this->getDbTable()->fetchAll('user_id IN (' . implode(', ', $userIds) . ')');
Howe...
What's the way of building "UPDATE table SET date = NOW() WHERE id = 1" query ?
$table->update(array('date' => 'NOW()'), 'id = 1');
Above code doesn't work properly.
...
Hey,
I have a zend app that displays a league table of race results. The basic process is to determine the list of events to be included, and then dynamically add a set of columns to a SQL query. My initial implementation is rather rubbish and i want to refector it. I manually build up a string of SQL and at the very end call db->fetch(...
how to call mysql stored procedure on zend framework?
any body may give an example?
thanks
...
Apologies for all this code, anyhow Im re-working a query into the Zend query way of working, this is what I have so far:
$db = Zend_Registry::get ( "db" );
$stmt = $db->query('
SELECT recipe_pictures.picture_id, recipe_pictures.picture_filename, course.course_name, cuisines.name, recipes.id, recipes.Title, recipes.Method,...
Following the sample code on http://framework.zend.com/manual/en/zend.db.profiler.html I have set up db profiling of my Zend Framework app.
application.ini:
db.profiler.enabled = true
View Helper:
$totalTime = $profiler->getTotalElapsedSecs();
$queryCount = $profiler->getTotalNumQueries();
$longestTime = 0;
$longestQuery = nul...
My apologies up front for being a) a newbie and b) almost certainly not giving enough info.
So I have app that uses ZF to fetch data from MySQL and display it to the user.
The user can select a row of data and fetch additional information (username, hostname, etc...).
I'm having an issue with PHP puking when ZF returns null data from ...
i have this xml file for Creating a container ,
if i want create a db for save this items and and create container from db
how should i do ?
<?xml version="1.0" encoding="utf-8"?>
<config>
<nav>
<logout>
<label>logout</label>
<controller>authentication</controller>
<action>logout</actio...
$db->update() returns the affected amount of rows.
There is no Zend_DB method for insert ... on duplicate key update ..., so one should use the query() method:
$result = $db->query('INSERT INTO table(key, field) SELECT val1, val2 FROM table as t2 ON DUPLICATE KEY UPDATE field = VALUES(field)');
To find out the amount of affected or in...
Hi,
I have one doubt in zend framework. I need all model details from project which i have done in zend framework. Is there any possibility to get all model details in zend framework.
Please help me..
Thanks and regards,
Prasanth P
...
I have the following query that extends from Zend_DB_Table_Abstract
$select = $this->select()
->from('expense_details',
array('SUM(expense_details_amount) AS total'))
->where('YEAR(expense_details_date) = ?', '2010')
->where('MONTH(expense_details_date) = ?', '01')
->where('expens...
I find this solution
$metadata = $result->getTable()->info('metadata');
echo $metadata['Continent']['DATA_TYPE'];
Hi,
I want to get enum values in Zend_Db.
My Code:
$select = $this->select();
$result = $select->fetchAll();
print_r($result->getTable());
Output:
Example Object
(
[_name] => country
[query] => Zend_Db_Table_Se...
I usually use ORM instead of SQL and I am slightly out of touch on the different JOINs...
SELECT `order_invoice`.*
, `client`.*
, `order_product`.*
, SUM(product.cost) as net
FROM `order_invoice`
LEFT JOIN `client`
ON order_invoice.client_id = client.client_id
LEFT JOIN `order_product`
ON order_invoice....
I have defined a function in my Navigation model that executes a query, and I was wondering if there's a more "Zendy" way of generating/executing the query. The query I'm using was proposed by Bill Karwin on another thread here for setting arbitrary record order. I tried using a prepared statement, but the values in the SIGN() function...
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 this:
$this
->select()
->from($this->_schema.'.'.$this->_name)
->where('a = ?', '1');
...
Hello,
I created a query for the zend framework, in which I try to retrieve the sum of a column, in this case the column named 'time'. This is the query I use:
$this->timequery = $this->db_tasks->fetchAll($this->db_tasks->select()->from('tasks', 'SUM(time)')->where('projectnumber =' . $this->value_project));
$this->view->sumtime = $t...
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 arbitrary number, the query works as expected. When I change it to a string, Zend tries to tr...