|
|
This post was updated on .
Hi,
Is there a way to insert an expression as a value using the Insert class?
use Zend\Db\Sql\Insert,
Zend\Db\Sql\Expression;
...
$insert = new Insert('test');
$insert->values(array(
'ip_address' => $_SERVER['REMOTE_ADDR'],
'added' => new Expression('NOW()') ));
$statment = $dbAdapter->createStatement();
$insert->prepareStatement($dbAdapter, $statment);
$statment->execute();
Throws an error:
PHP Catchable fatal error: Object of class Zend\Db\Sql\Expression could not be converted to string in /****/Zend/Db/Adapter/Driver/Mysqli/Statement.php on line 209
Any ideas?
Thanks!!
|