当前位置: 首页>>代码示例>>PHP>>正文


PHP Zend_Db_Statement_Pdo::execute方法代码示例

本文整理汇总了PHP中Zend_Db_Statement_Pdo::execute方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Db_Statement_Pdo::execute方法的具体用法?PHP Zend_Db_Statement_Pdo::execute怎么用?PHP Zend_Db_Statement_Pdo::execute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend_Db_Statement_Pdo的用法示例。


在下文中一共展示了Zend_Db_Statement_Pdo::execute方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: editAction

 public function editAction()
 {
     //$this->_helper->viewRenderer->setNoRender(true);
     $referer = $this->getRequest()->getHeader('Referer');
     $id = $this->getParam('id');
     $userForm = new Form_Auth_Add();
     try {
         #using named parameters
         /*
         $sql = 'SELECT * FROM users WHERE id = :id';
         $stmt = new Zend_Db_Statement_Pdo($this->db, $sql);
         $stmt->execute(array(':id' => $this->getParam('id')));
         */
         #using positional parameters
         $sql = 'SELECT * FROM users WHERE id = ?';
         $stmt = new Zend_Db_Statement_Pdo($this->db, $sql);
         $stmt->execute(array($id));
         $userData = $stmt->fetchAll();
         if ($this->getRequest()->isPost()) {
             print_r($usersData);
             exit;
             // clearing previous values
             $usersData = array();
             $userData = $this->getRequest()->getPost();
             if ($userForm->isValid($userData)) {
                 $this->db->update($userData, 'id = ' . (int) $id);
                 $this->_redirect($referer);
             }
         }
         $userForm->populate($userData);
         print_r($userData[0]);
         //exit;
         //$this->view->users = $usersData; // oneliner // $this->view->users = $this->db->fetchAll($sql);
         $this->view->userForm = $userForm;
         // oneliner // $this->view->users = $this->db->fetchAll($sql);
     } catch (Exception $e) {
         $this->_helper->flashMessenger('An error_log');
     }
 }
开发者ID:ajaysarw,项目名称:zf1,代码行数:39,代码来源:UserController.php

示例2: getFirstOrLastLogForUser

    public function getFirstOrLastLogForUser($idUser, $first = true)
    {
        $db = $this->getDbTable()->getAdapter();
        $sql = '	SELECT *
					FROM pic 
					WHERE user_id = :idUser
					';
        if ($first) {
            $sql .= ' ORDER BY date_shot DESC LIMIT 1';
        } else {
            $sql .= ' ORDER BY date_shot ASC LIMIT 1';
        }
        $stmt = new Zend_Db_Statement_Pdo($db, $sql);
        $stmt->bindParam(':idUser', $idUser);
        $stmt->execute();
        $resultSet = $stmt->fetchAll();
        $arrPics = $this->createObjektArr($resultSet);
        if (empty($arrPics)) {
            return 0;
        } else {
            return $arrPics[0];
        }
    }
开发者ID:naegeles,项目名称:Logit,代码行数:23,代码来源:PictureMapper.php

示例3: createTimeslots

 /**
  * Create default timeslot values based on days/session duration
  *
  * @param	array	$post	Post request
  */
 public function createTimeslots($post)
 {
     $db = $this->getAdapter();
     $dt = new Zend_Date($post['start'], 'dd/MM/YYYY hh:mm');
     $sql = 'insert into timeslots (tstart, tend, number, type, conference_id)' . 'values (:tstart, :tend, :number, :type, ' . (int) $post['id'] . ')';
     $stmt = new Zend_Db_Statement_Pdo($db, $sql);
     $n = 0;
     // for every day add slot/break/lunch/slot/break/slot
     for ($i = 1; $i <= $post['days']; $i++) {
         $stmt->execute(array(':tstart' => $dt->get(Zend_Date::ISO_8601), ':tend' => $dt->add('90', 'mm')->get(Zend_Date::ISO_8601), ':number' => $n + 1, ':type' => 1));
         $stmt->execute(array(':tstart' => $dt->get(Zend_Date::ISO_8601), ':tend' => $dt->add('30', 'mm')->get(Zend_Date::ISO_8601), ':number' => 0, ':type' => 2));
         $stmt->execute(array(':tstart' => $dt->get(Zend_Date::ISO_8601), ':tend' => $dt->add('90', 'mm')->get(Zend_Date::ISO_8601), ':number' => $n + 2, ':type' => 1));
         $stmt->execute(array(':tstart' => $dt->get(Zend_Date::ISO_8601), ':tend' => $dt->add('90', 'mm')->get(Zend_Date::ISO_8601), ':number' => 0, ':type' => 3));
         $stmt->execute(array(':tstart' => $dt->get(Zend_Date::ISO_8601), ':tend' => $dt->add('90', 'mm')->get(Zend_Date::ISO_8601), ':number' => $n + 3, ':type' => 1));
         $stmt->execute(array(':tstart' => $dt->get(Zend_Date::ISO_8601), ':tend' => $dt->add('30', 'mm')->get(Zend_Date::ISO_8601), ':number' => 0, ':type' => 2));
         $stmt->execute(array(':tstart' => $dt->get(Zend_Date::ISO_8601), ':tend' => $dt->add('90', 'mm')->get(Zend_Date::ISO_8601), ':number' => $n = $n + 4, ':type' => 1));
         // reset date and add a day
         $dt = new Zend_Date($post['start'], 'dd/MM/YYYY hh:mm');
         $dt->add($i, Zend_Date::DAY_SHORT);
     }
     return true;
 }
开发者ID:GEANT,项目名称:CORE,代码行数:27,代码来源:Conferences.php

示例4: insertAllSessionData

 function insertAllSessionData($session_date, $records)
 {
     $db = Zend_Registry::get('db');
     $i = 0;
     $max_inserts = 100;
     for ($rows = 0; $rows < count($records); $rows += $max_inserts) {
         $values = array();
         $sql = 'INSERT INTO t_exercise_data
                    (session_date,
                     time,
                     distance,
                     heartrate,
                     speed,
                     latitude,
                     longitude,
                     altitude,
                     cadence,
                     temperature,
                     power,
                     gradient,
                     userid)
                 VALUES ';
         /* Do a multi insert */
         for ($i = 0; $i < $max_inserts && $i + $rows < count($records); $i++) {
             if ($i != 0) {
                 $sql .= ', ';
             }
             $sql .= '(:session_date,
                       :time' . $i . ',
                       :distance' . $i . ',
                       :heartrate' . $i . ',
                       :speed' . $i . ',
                       :latitude' . $i . ',
                       :longitude' . $i . ',
                       :altitude' . $i . ',
                       :cadence' . $i . ',
                       :temperature' . $i . ',
                       :power' . $i . ',
                       :gradient' . $i . ',
                       :userid) ';
             $values[':time' . $i] = $records[$i + $rows]->interval;
             $values[':distance' . $i] = $records[$i + $rows]->distance;
             $values[':heartrate' . $i] = $records[$i + $rows]->heart_rate;
             $values[':speed' . $i] = $records[$i + $rows]->speed;
             $values[':latitude' . $i] = $records[$i + $rows]->position_lat;
             $values[':longitude' . $i] = $records[$i + $rows]->position_long;
             $values[':altitude' . $i] = $records[$i + $rows]->altitude;
             $values[':cadence' . $i] = $records[$i + $rows]->cadence;
             $values[':temperature' . $i] = $records[$i + $rows]->temperature;
             $values[':power' . $i] = $records[$i + $rows]->power;
             $values[':gradient' . $i] = $records[$i + $rows]->gradient;
         }
         //$stmt = new Zend_Db_Statement($db, $sql);
         $stmt = new Zend_Db_Statement_Pdo($db, $sql);
         /* Add the constant values for all rows */
         $values[':session_date'] = $session_date;
         $values[':userid'] = Core_Common::getCurrentUserLogin();
         $stmt->execute($values);
     }
 }
开发者ID:ptarcher,项目名称:exercise_mvc,代码行数:60,代码来源:API.php

示例5: searchFriendsByName

    public function searchFriendsByName($idUser, $username)
    {
        $db = $this->getDbTable()->getAdapter();
        $sql = '	SELECT 	f.*
					FROM 	user f, 
							user_friends u 
					WHERE 	u.id_user = :idUser
					AND 	f.id = u.id_friend	
					AND		f.username LIKE :name ';
        $username = '%' . $username . '%';
        $stmt = new Zend_Db_Statement_Pdo($db, $sql);
        $stmt->bindParam(':idUser', $idUser);
        $stmt->bindParam(':name', $username);
        $stmt->execute();
        $resultSet = $stmt->fetchAll();
        $arrRestaurants = $this->createObjektArr($resultSet);
        return $arrRestaurants;
    }
开发者ID:naegeles,项目名称:Logit,代码行数:18,代码来源:UserMapper.php


注:本文中的Zend_Db_Statement_Pdo::execute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。