Hi,
I'm connecting to SQL Server using the Zend_Db_Adapter_Sqlsrv via SQL Server driver for PHP
Wondering how I can insert a date which is read in from a web form in format dd/mm/yyyy into a datetime column
Thanks in advance
...
I want to use a query which uses LIKE .. for e.g select * from xxxx where zzzz LIKE 'a%';
How can I do that using Zend DB?
I have already tried something like $db->query('SELECT * FROM XXXX where zzzzz LIKE ?','\'' . $query .'%\''); but it is not working.
Thanks
...
I have the following raw query which moves items from a shopping cart to an order table:
insert into webshop_order_item (
order_id,
product_id,
count
)
select
1,
product_id,
count
from
webshop_cart
I am using the Zend DB for all my modeling. I was wondering if there is a way of achieving the goal of the ab...
Ok, I'm about 50% done with the "30 minute" quickstart guide from Zend.
I must be missing something, because this seems like a total waste of time. The point of this quickguide is to create a guestbook, something I could do in 5 minutes with regular naked non-framework php.
Here's my path to zend framework:
c:/program files/wamp/www/_z...
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;
...
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 requests without any queries, only using cache.
How to ask Zend_Db to run 'SET NAMES utf...
I have an SQLite database, eventually will be a MySQL database and I'm using Zend Framework. I'm trying to fetch all the rows in a table where the 'date_accepted' column is empty/null/doesn't have a value. This is what I have so far:
public function fetchAllPending()
{
$select = $this->getDbTable()->select();
$select->where('date_acce...
I'm parsing a json feed routinely and need to insert only the newest users from the feed and ignore existing users.
I think what I need is ON DUPLICATE KEY UPDATE or INSERT IGNORE based on some searching but I'm not quite sure which is why I'm asking - so for example:
users
1 John
2 Bob
Partial JSON:
{ userid:1, name:'John' ...
The server I'm porting to doesn't have PDO nor Mysqli extensions enabled ( though it is running PHP5 ). I don't see any MySql.php class in Zend/Db/Adapter - is there some convention to using native MySQL? Or some sort of workaround? Perhaps using an older version of Zend?
And I don't have access to modify the php.ini.
...
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?
...
Hey,
I have to work on this project written using Zend Framework. This is a project developed by somebody else that is unreachable at this time and I only have the php code but not the database.
I've never worked with Zend Framework but from what I've managed to understand it's using Zend_db to relate with a MySQL database. Like I said...
It seems like there's a few different ways to join two tables using the Zend Framework, but I've never done it before so I don't know which is the best way to do it.
This is what I'm trying to do...
I have 3 tables in my database:
users
( id , name )
groups
( id , name )
group_members
( id , group_id , user_id )
I'm tryi...
I have a form with a select element that I need to populate with values from a database. Specifically, the name and id of the current users. The fetchPairs() function works great for this! However, I need to concatenate the value from the first_name column and the last_name column and display this as the option label. Is there a way to d...
I'm just wondering what the syntax is to do a db select in Zend Framework where two values are true. Example: I want to find if a user is already a member of a group:
$userId = 1;
$groupId = 2;
$db = Zend_Db_Table::getDefaultAdapter();
$select = new Zend_Db_Select($db);
$select->from('group_members')
->where('user_id = ?', $userId);...
Normally, this would work for me:
$db = Zend_Db_Table::getDefaultAdapter();
$where = $db->quoteInto('id = ?', $id);
$db->delete('tablename', $where);
but I have to match two ids. So I don't really know how to structure it.
WHERE first_id = 'id1' AND second_id = 'id2'
So how do I do this with the Zend Framework?
...
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?
...
Currently, I'm getting a regular DbTable Auth Adapter:
protected function _getAuthAdapter($formData)
{
$dbAdapter = Zend_Db_Table::getDefaultAdapter();
$authAdapter = new Zend_Auth_Adapter_DbTable($dbAdapter);
$authAdapter->setTableName('users')
->setIdentityColumn('username')
->setCredentialColumn('passw...
Hi,
I have the following code:
public function checkLoginDetails($email, $password) {
$select = $this->select ();
$select->where ( "password=?", md5($password) );
$select->where ( "email=?", $email );
return $this->fetchRow($select);
}
email and password come directly from the user. Do I need to filter email with, say, mysql_real...
I keep getting this error in my application and can't figure out what it means and where it's happening. I know it's in one of my models but I don't understand the error.
SQLSTATE[HY093]: Invalid parameter number: no parameters were bound
Have you ever run into this problem?
Update: I think I've narrowed it down to this code:
$db = ...
I'm using Zend_Db to query a table. I have some WHERE clauses that need to be dates and it's not clear (at first glance) how to do this "the right way". Does Zend_Db provide an abstraction so I don't need to concern myself with how the backend (Oracle, MySQL, etc.) expects its dates? Or do I need to format things in the way my backend ...