Welcome, Guest. Register Now!
   
Mark Forums Read Mark Forums Read Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-28-2007, 10:08 AM
Junior Member
 
Join Date: Aug 2007
Posts: 6
Question INSERT function

How can i make a query like
Code:
INSERT INTO `table` (`datetime`) VALUES (NOW())
with the ZEND_DB::insert method?
The problem is i can't insert a result of a MySQL function.
Please, don't suggest generating datetime in PHP.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 08-28-2007, 11:42 AM
Member
 
Join Date: Aug 2007
Location: Tarnow/Krakow, Poland, EU
Posts: 30
Default

Use Zend_Db_Expr. An example from ZF docs:

Code:
<?php

$table = new Bugs();

$data = array(
    'created_on'      => new Zend_Db_Expr('CURDATE()'),
    'bug_description' => 'Something wrong',
    'bug_status'      => 'NEW'
);
__________________
I don't trust anything that bleeds for five days and doesn't die.
www.inetive.pl
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 08-28-2007, 11:52 AM
Junior Member
 
Join Date: Aug 2007
Posts: 6
Default

Quote:
Originally Posted by borec View Post
Use Zend_Db_Expr. An example from ZF docs:
I remember it was somwhere in the docs, but searched for it for 2 days and couldn't find.
Thanks!
Could you provide a link where exactly it was?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 08-28-2007, 12:12 PM
Member
 
Join Date: Aug 2007
Location: Tarnow/Krakow, Poland, EU
Posts: 30
Default

Quote:
Originally Posted by ec_stasis View Post
Could you provide a link where exactly it was?
Sure: Zend Framework: Documentation
__________________
I don't trust anything that bleeds for five days and doesn't die.
www.inetive.pl
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 08-28-2007, 12:51 PM
Junior Member
 
Join Date: Aug 2007
Posts: 6
Default

Thanks for help
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 04:07 AM.