CREATE TABLE IF NOT EXISTS `zs_max_by_surovina` ( `id` int(11) NOT NULL AUTO_INCREMENT, `products_id` int(10) NOT NULL, `surovina_id` int(10) NOT NULL, `max_min` int(10) NOT NULL, `max_max` int(10) NOT NULL, `create_date` datetime NOT NULL, `update_date` datetime NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `products_id` (`products_id`,`surovina_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=5 ;
I put into DB id for testing
$database = \Db\MaxBySurovina::all(array('conditions' => array('products_id = ? AND surovina_id = ?',1, 1))); //DOES NOT WORK - $database is empty Array
$database = \Db\MaxBySurovina::find( 1); WORKS FINE :/
I need search for products_id And surovina_id.
Server: MySQL 5.5.44-0ubuntu0.14.04.1 - (Ubuntu)
PHP 5.5.9-1ubuntu4.13 (cli) (built: Sep 29 2015 15:24:49) Copyright (c) 1997-2014 The PHP Group Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies with Xdebug v2.2.3, Copyright (c) 2002-2013, by Derick Rethans
Thank you in advance for help
Vasek KeberdleTue Oct 13 04:11:45 -0400 2015
Yes, I am NewBie whit PhpActiveRecords \Db\MaxBySurovina::all -> get empty array if find 0 results. I except no array but instance of MaxBySurovina..
Subject: Database::all doesnot work
Hi,
I have database:
CREATE TABLE IF NOT EXISTS `zs_max_by_surovina` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`products_id` int(10) NOT NULL,
`surovina_id` int(10) NOT NULL,
`max_min` int(10) NOT NULL,
`max_max` int(10) NOT NULL,
`create_date` datetime NOT NULL,
`update_date` datetime NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `products_id` (`products_id`,`surovina_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=5 ;
I put into DB id for testing
I need search for products_id And surovina_id.
Server: MySQL
5.5.44-0ubuntu0.14.04.1 - (Ubuntu)
PHP 5.5.9-1ubuntu4.13 (cli) (built: Sep 29 2015 15:24:49)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies
with Xdebug v2.2.3, Copyright (c) 2002-2013, by Derick Rethans
Thank you in advance for help