插入数据时Phalcon PHP错误(在编辑FROM_UNIXTIME之后)

时间:2015-07-19 14:13:33

标签: php mysql phalcon

我正在使用Phalcon在php上写一个restful api。因为DB我正在使用MySQL。 当我添加FROM_UNIXTIME()时,我开始出错;

    $query = "INSERT INTO readings (sensor_id, value, error, timestamp) VALUES (:sensor_id:, :value:, :error:, FROM_UNIXTIME( :timestamp: ));";

    $status = $app->modelsManager->executeQuery($query, array(
        'sensor_id' =>$reading->sensor_id,
        'value' => $reading->value,
        'error' => $reading->error,
        'timestamp' => $reading->timestamp
    ));

错误:

  

[Sun Jul 19 17:10:19.895081 2015] [:error] [pid 24057] [client 46.39.49.135:49183] PHP致命错误:未捕获的异常' Phalcon \ Mvc \ Model \ Exception'有消息'扫描错误之前''解析时:INSERT INTO读数(sensor_id,value,error,timestamp)VALUES(:sensor_id:,:value:,:error:,FROM_UNIXTIME(:timestamp :)); (127)'在/var/www/rest.technical-craft.ru/public/index.php:42\nStack trace:\ n#0 [内部函数]:Phalcon \ Mvc \ Model \ Query-> parse()\ n# 1 [内部函数]:Phalcon \ Mvc \ Model \ Query-> execute()\ n#2 /var/www/rest.technical-craft.ru/public/index.php(42):Phalcon \ Mvc \ Model \ Manager-> executeQuery(' INSERT INTO rea ...',Array)\ n#3 [内部函数]:{closure}()\ n#4 /var/www/rest.technical -craft.ru/public/index.php(67):Phalcon \ Mvc \ Micro-> handle()\ n#5 {main} \ n抛出/var/www/rest.technical-craft.ru/public第42行的/index.php

0 个答案:

没有答案