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


PHP Db::lastInsertId方法代码示例

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


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

示例1: addVideo

 /**
  * Генерирует случайное виео и вставляет его в базу данных
  * @throws Exception
  */
 protected function addVideo()
 {
     $categories = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
     shuffle($categories);
     $categoriesIds = implode(',', array_slice($categories, 0, rand(1, 3)));
     $name = substr(str_shuffle("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), 0, 10);
     $this->db->query("INSERT INTO video (name, categories) VALUES (:name, :categories)", ['name' => $name, 'categories' => $categoriesIds]);
     $videoId = $this->db->lastInsertId();
     for ($i = 0; $i <= rand(10, 100); $i++) {
         $this->app->like($videoId);
     }
     for ($i = 0; $i <= rand(10, 100); $i++) {
         $this->app->dislike($videoId);
     }
 }
开发者ID:alexboo,项目名称:traffics-task2,代码行数:19,代码来源:Migration.php

示例2: saveAttribute

 public function saveAttribute($dataForm, $attributeId = "")
 {
     global $mySession;
     $db = new Db();
     $dataForm = SetupMagicQuotesTrim($dataForm);
     if ($attributeId == "") {
         $chkQry = $db->runQuery("select * from " . ATTRIBUTE . " where attribute_name like '%" . mysql_escape_string(trim($dataForm['attribute_name'])) . "' ");
         if ($chkQry != "" and count($chkQry) > 0) {
             //if Same Question exists than return false / 0
             // No Data Inserted
             return 0;
         } else {
             $data = array();
             $data['attribute_name'] = $dataForm['attribute_name'];
             $data['attribute_status'] = $dataForm['attribute_status'];
             $db->save(ATTRIBUTE, $data);
             $latestId = $db->lastInsertId();
             return 1;
         }
     } else {
         $chkQry = $db->runQuery("select * from " . ATTRIBUTE . " where attribute_name like '%" . mysql_escape_string(trim($dataForm['attribute_name'])) . "' and attribute_id != '" . $attributeId . "'  ");
         if ($chkQry != "" and count($chkQry) > 0) {
             //if Same Question exists than return false / 0
             // No Data Inserted
             return 0;
         } else {
             $data = array();
             $data['attribute_name'] = $dataForm['attribute_name'];
             $data['attribute_status'] = $dataForm['attribute_status'];
             $condition = "attribute_id = " . $attributeId;
             $db->modify(ATTRIBUTE, $data, $condition);
             return 1;
         }
     }
 }
开发者ID:ankuradhey,项目名称:dealtrip,代码行数:35,代码来源:Attribute.php

示例3: saveReview

 public function saveReview($dataForm)
 {
     global $mySession;
     $db = new Db();
     $data_update = array();
     $chckArr = $db->runQuery("select * from " . PROPERTY . " where propertycode = '" . trim($dataForm['ppty_no']) . "' and status = '3'");
     if (count($chckArr) > 0 && $chckArr != "") {
         $data_update['guest_name'] = $dataForm['full_name'];
         $data_update['location'] = $dataForm['location'];
         $check_in = explode("/", $dataForm['check_in']);
         $data_update['check_in'] = date('Y-m-d', strtotime($check_in[2] . "-" . $check_in[1] . "-" . $check_in[0]));
         $data_update['rating'] = $dataForm['rating'];
         $data_update['user_id'] = $mySession->LoggedUserId;
         $data_update['headline'] = $dataForm['headline'];
         $data_update['comment'] = $dataForm['comment'];
         $data_update['review'] = $dataForm['review'];
         $data_update['uType'] = $mySession->LoggedUserType == '1' ? "1" : "0";
         $data_update['review_date'] = date("Y-m-d");
         $data_update["property_id"] = $chckArr[0]['id'];
         $data_update['guest_image'] = $mySession->LoggedUser['image'];
         copy(SITE_ROOT . "images/" . $mySession->LoggedUser['image'], SITE_ROOT . "images/profile/" . $mySession->LoggedUser['image']);
         $db->save(OWNER_REVIEW, $data_update);
         $review_id = $db->lastInsertId();
         //====== code to enter new latest review properties ===============
         //two cases are there
         //1. if already an entry is there within latest reviews
         //2. first entry is made for specific property
         $reviewPptyArr = $db->runQuery("select * from " . LATEST_REVIEW . " where r_property_id = '" . $chckArr[0]['id'] . "'  ");
         //case 1
         if (count($reviewPptyArr) > 0 && $reviewPptyArr != "") {
             $db->delete(LATEST_REVIEW, "r_id = " . $reviewPptyArr[0]['r_id']);
             $updateData = array();
             $updateData['r_order'] = new Zend_Db_Expr('r_order-1');
             $db->modify(LATEST_REVIEW, $updateData, "r_order > " . $reviewPptyArr[0]['r_order']);
         } else {
             $updateData = array();
             $updateData['r_order'] = new Zend_Db_Expr('r_order+1');
             $db->modify(LATEST_REVIEW, $updateData);
             $saveData = array();
             $saveData['r_property_id'] = $chckArr[0]['id'];
             $saveData['r_order'] = '1';
             //$saveData['r_review_id'] = $review_id;
             $saveData['r_status'] = '1';
             $db->save(LATEST_REVIEW, $saveData);
         }
         //-----------------------------------------------------------------
         return 1;
     } else {
         return 0;
     }
 }
开发者ID:ankuradhey,项目名称:dealtrip,代码行数:51,代码来源:Review.php

示例4: saveSubscription

 public function saveSubscription($dataForm, $subscriptionId = "")
 {
     global $mySession;
     $db = new Db();
     $dataForm = SetupMagicQuotesTrim($dataForm);
     if (empty($subscriptionId)) {
         $data = array();
         //code for inserting order
         $db->save("subscriber", $dataForm);
         $latestId = $db->lastInsertId();
         return 1;
     } else {
         $condition = "subscriber_id = " . $subscriptionId;
         $db->modify("subscriber", $dataForm, $condition);
         return 2;
     }
 }
开发者ID:ankuradhey,项目名称:dealtrip,代码行数:17,代码来源:Subscription.php

示例5: SaveSub

 public function SaveSub($dataForm)
 {
     global $mySession;
     $db = new Db();
     $value = $_POST['plan'];
     $dataForm = SetupMagicQuotes($dataForm);
     $chkQry = $db->runQuery("select * from " . SUBSCRIPTION . " where email_address='" . $dataForm['email_address'] . "'");
     if ($chkQry != "" and count($chkQry) > 0) {
         return 0;
     } else {
         $dataInsert['first_name'] = $dataForm['first_name'];
         $dataInsert['last_name'] = $dataForm['last_name'];
         $dataInsert['email_address'] = $dataForm['email_address'];
         $dataInsert['username'] = $dataForm['username'];
         $dataInsert['password'] = md5($dataForm['password_o']);
         $dataInsert['address'] = $dataForm['address'];
         $dataInsert['country_id'] = $dataForm['country_id'];
         //$dataInsert['state_id']=$dataForm['state_id'];
         //$dataInsert['city_id']=$dataForm['city_id'];
         $dataInsert['zipcode'] = $dataForm['zipcode'];
         $dataInsert['phone_number'] = $dataForm['phone_number'];
         $dataInsert['mobile_number'] = $dataForm['mobile_number'];
         $dataInsert['id'] = $value;
         $dataInsert['date_joined'] = date('Y-m-d H:i:s');
         $dataInsert['user_status'] = '1';
         $dataInsert['user_type'] = $dataForm['signup_type'];
         $db->save(USERS, $dataInsert);
         $UserId = $db->lastInsertId();
         //code to send registration email
         $fullName = $dataForm['first_name'] . ' ' . $dataForm['last_name'];
         $Url = '<a href="' . APPLICATION_URL . '">' . APPLICATION_URL . '</a>';
         $templateData = $db->runQuery("select * from " . EMAIL_TEMPLATES . " where template_id='2'");
         $messageText = $templateData[0]['email_body'];
         $subject = $templateData[0]['email_subject'];
         $messageText = str_replace("[NAME]", "<strong>" . $fullName . "</strong>", $messageText);
         $messageText = str_replace("[SITENAME]", "<strong>" . SITE_NAME . "</strong>", $messageText);
         $messageText = str_replace("[LOGINNAME]", "<strong>" . $dataForm['username'] . "</strong>", $messageText);
         $messageText = str_replace("[PASSWORD]", "<strong>" . $dataForm['password_o'] . "</strong>", $messageText);
         $messageText = str_replace("[SITEURL]", "<strong>" . $Url . "</strong>", $messageText);
         SendEmail($dataForm['email_address'], $subject, $messageText);
         //code to send registration email
         return $UserId;
     }
 }
开发者ID:ankuradhey,项目名称:dealtrip,代码行数:44,代码来源:Subscription.php

示例6: SaveUser

 public function SaveUser($dataForm)
 {
     global $mySession;
     $db = new Db();
     $dataForm = SetupMagicQuotesTrim($dataForm);
     $chkQry = $db->runQuery("select * from " . USERS . " where email_address='" . $dataForm['email_address'] . "'");
     if ($chkQry != "" and count($chkQry) > 0) {
         return 0;
     } else {
         if ($dataForm['photo'] == "") {
             if ($dataForm['sex'] == '2') {
                 $noImage = "defaultuserfemaleprofile.png";
             } else {
                 $noImage = "defaultusermaleprofile.png";
             }
         } else {
             $imageNewName = time() . "_" . $dataForm['photo'];
             @rename(SITE_ROOT . 'images/' . $dataForm['photo'], SITE_ROOT . 'images/' . $imageNewName);
             $noImage = $imageNewName;
         }
         $dataInsert['uType'] = $dataForm['uType'];
         $dataInsert['first_name'] = $dataForm['first_name'];
         $dataInsert['last_name'] = $dataForm['last_name'];
         $dataInsert['title'] = $dataForm['title'];
         $dataInsert['email_address'] = $dataForm['email_address'];
         $dataInsert['password'] = md5($dataForm['password']);
         $dataInsert['country_id'] = $dataForm['country_id'];
         $dataInsert['state_id'] = $dataForm['state_id'];
         $dataInsert['city_id'] = $dataForm['city_id'];
         $dataInsert['zipcode'] = $dataForm['zipcode'];
         $dataInsert['home_number'] = $dataForm['home_number'];
         $dataInsert['work_number'] = $dataForm['work_number'];
         $dataInsert['mobile_number'] = $dataForm['mobile_number'];
         $dataInsert['web'] = $dataForm['webaddress'];
         $dataInsert['address'] = $dataForm['address'];
         $dataInsert['date_joined'] = date("Y-m-d H:i:s");
         $dataInsert['image'] = $noImage;
         $dataInsert['user_status'] = '1';
         $db->save(USERS, $dataInsert);
         return $db->lastInsertId();
     }
 }
开发者ID:ankuradhey,项目名称:dealtrip,代码行数:42,代码来源:Users.php

示例7: SaveEvent

 public function SaveEvent($dataForm)
 {
     global $mySession;
     $db = new Db();
     $chkQry = $db->runQuery("select * from " . EVENTS . " where event_title='" . mysql_escape_string($dataForm['event_title']) . "'");
     if ($chkQry != "" and count($chkQry) > 0) {
         return 0;
     } else {
         $EventImagesPath = "";
         for ($counter = 1; $counter <= 10; $counter++) {
             $eventImage = $dataForm['event_image_Path' . $counter];
             if ($dataForm['event_image' . $counter] != "") {
                 $eventImage = time() . "_" . $dataForm['event_image' . $counter];
                 @rename(SITE_ROOT . 'images/events/' . $dataForm['event_image' . $counter], SITE_ROOT . 'images/events/' . $eventImage);
             }
             if ($eventImage != "") {
                 $EventImagesPath .= $eventImage . ",";
             }
         }
         if ($EventImagesPath != "") {
             $EventImagesPath = substr($EventImagesPath, 0, strlen($EventImagesPath) - 1);
         }
         if ($mySession->LoggedUserId > 0) {
             $dataInsert['user_id'] = $mySession->LoggedUserId;
         }
         $dataInsert['event_title'] = $dataForm['event_title'];
         $dataInsert['event_description'] = $dataForm['event_description'];
         $dataInsert['event_date'] = changeDate($dataForm['event_date'], 0);
         $dataInsert['event_time_from'] = $dataForm['hour_from'] . "::" . $dataForm['minute_from'] . "::" . $dataForm['ampm_from'];
         $dataInsert['event_time_to'] = $dataForm['hour_to'] . "::" . $dataForm['minute_to'] . "::" . $dataForm['ampm_to'];
         $dataInsert['event_image'] = $EventImagesPath;
         $dataInsert['event_venue'] = $dataForm['event_venue'];
         $dataInsert['event_location'] = $dataForm['address'];
         $dataInsert['event_status'] = '1';
         $dataInsert['date_event_added'] = date('Y-m-d H:i:s');
         $dataInsert['event_lat'] = $dataForm['latitude'];
         $dataInsert['event_long'] = $dataForm['longitude'];
         $db->save(EVENTS, $dataInsert);
         return $db->lastInsertId();
     }
 }
开发者ID:ankuradhey,项目名称:dealtrip,代码行数:41,代码来源:Event.php

示例8: insert

 protected function insert()
 {
     $cols = array_keys($this->data);
     $data = [];
     foreach ($cols as $col) {
         $data[':' . $col] = $this->data[$col];
     }
     // INSERT INTO table_name (col_name, ...) VALUES (:col_name, ...)
     $sql = '
   INSERT INTO ' . static::$table . '
   (' . implode(', ', $cols) . ')
   VALUES
   (' . implode(', ', array_keys($data)) . ')
 ';
     $db = new Db();
     $res = $db->execute($sql, $data);
     if (false === $res) {
         return false;
     }
     $this->id = $db->lastInsertId();
     return true;
 }
开发者ID:sergey07,项目名称:parrot-php,代码行数:22,代码来源:AbstractModel.php

示例9: savedesignimageAction

 public function savedesignimageAction()
 {
     global $mySession;
     $db = new Db();
     $manage_image_name = array();
     if (isset($_REQUEST["frontImage"]) && !empty($_REQUEST["frontImage"])) {
         $frontImageName = $_REQUEST['frontFileName'] . "_" . rand(10, 100) . '.png';
         $frontImage = $_POST["frontImage"];
         $this->saveDataUrlUserDesign($frontImage, $frontImageName);
         $manage_image_name['frontimage'] = $frontImageName;
     }
     if (isset($_REQUEST["backImage"]) && !empty($_REQUEST["backImage"])) {
         $backImageName = $_REQUEST['backFileName'] . "_" . rand(10, 100) . '.png';
         $backImage = $_POST["backImage"];
         $this->saveDataUrlUserDesign($backImage, $backImageName);
         $manage_image_name['backimage'] = $backImageName;
     }
     $db->save(MANAGEIMAGENAME, $manage_image_name);
     $manage_image_name['mig_id'] = $db->lastInsertId();
     echo json_encode($manage_image_name);
     exit;
 }
开发者ID:Alexeykolobov,项目名称:php,代码行数:22,代码来源:LaunchcampaignController.php

示例10: array

		</h4>
		<pre>
			<code class="lang-php">
&lt;?php
	$DB-&gt;lastInsertId();
?&gt;
			</code>
		</pre>
		<p>
			Result:
		</p>
		<pre>
			<code class="lang-php">
ID for array("color"=>"yellow","name"=>"mango","id"=>null): 
<?php 
echo $DB->lastInsertId();
?>
			</code>
		</pre>
		<h4>
			Get the number of queries since the object initialization
		</h4>
		<pre>
			<code class="lang-php">
&lt;?php
	$DB-&gt;querycount;
?&gt;
			</code>
		</pre>
		<p>
			Result:
开发者ID:yeosz,项目名称:PHP-PDO-MySQL-Class,代码行数:31,代码来源:demo.php

示例11: SaveUser

 public function SaveUser($dataForm, $SignUpfor)
 {
     global $mySession;
     $db = new Db();
     $dataForm = SetupMagicQuotesTrim($dataForm);
     if ($dataForm['photo'] == "") {
         if ($dataForm['sex'] == '2') {
             $noImage = "defaultuserfemaleprofile.png";
         } else {
             $noImage = "defaultusermaleprofile.png";
         }
     } else {
         $imageNewName = time() . "_" . $dataForm['photo'];
         @rename(SITE_ROOT . 'images/' . $dataForm['photo'], SITE_ROOT . 'images/' . $imageNewName);
         $noImage = $imageNewName;
     }
     //	$chkQry=$db->runQuery("select * from ".USERS." where email_address='".mysql_escape_string($dataForm['email_address'])."'");
     /*		if($chkQry!="" and count($chkQry)>0)
     		{
     		return 0;
     		}
     		else
     		{		
     */
     $dataInsert['uType'] = $SignUpfor;
     //$dataInsert['username']=$dataForm['username'];
     $dataInsert['first_name'] = $dataForm['first_name'];
     $dataInsert['last_name'] = $dataForm['last_name'];
     $dataInsert['title'] = $dataForm['title'];
     $dataInsert['email_address'] = $dataForm['email_address'];
     $dataInsert['password'] = md5($dataForm['password']);
     $dataInsert['country_id'] = $dataForm['country_id'];
     $dataInsert['state_id'] = $dataForm['state_id'];
     $dataInsert['city_id'] = $dataForm['city_id'];
     $dataInsert['zipcode'] = $dataForm['zipcode'];
     $dataInsert['home_number'] = $dataForm['home_number'];
     $dataInsert['work_number'] = $dataForm['work_number'];
     $dataInsert['mobile_number'] = $dataForm['mobile_number'];
     //$dataInsert['sex']=$dataForm['sex'];
     $dataInsert['address'] = $dataForm['address'];
     $dataInsert['web'] = $dataForm['webaddress'];
     $dataInsert['date_joined'] = date("Y-m-d H:i:s");
     $dataInsert['image'] = $noImage;
     $dataInsert['user_status'] = '0';
     /*$lat_long = getLatLongFromAddress($dataInsert['country_id'],$dataInsert['state_id'],$dataInsert['city_id'],$dataInsert['address']);
     		$lat_long = explode("::",$lat_long);
     		$dataInsert['cletitude'] = $lat_long[0];
     		$dataInsert['clongitude'] = $lat_long[1];*/
     $db->save(USERS, $dataInsert);
     $UserId = $db->lastInsertId();
     $dataUpdate['password_reset'] = md5($UserId);
     $condition = " user_id = " . $UserId;
     $db->modify(USERS, $dataUpdate, $condition);
     $fullName = $dataForm['email_address'];
     $Url = '<a href="' . APPLICATION_URL . '">' . APPLICATION_URL . '</a>';
     //$ActivationLink='<a href="'.APPLICATION_URL.'signup/activate/cId/'.md5($UserId).':'.$SignUpfor.'">'.APPLICATION_URL.'signup/activate/cId/'.md5($UserId).':'.$SignUpfor.'</a>';
     $ActivationLink = APPLICATION_URL . 'signup/activate/cId/' . md5($UserId);
     $templateData = $db->runQuery("select * from " . EMAIL_TEMPLATES . " where template_id='4'");
     $messageText = $templateData[0]['email_body'];
     $subject = $templateData[0]['email_subject'];
     $messageText = str_replace("[NAME]", $fullName, $messageText);
     $messageText = str_replace("[SITENAME]", SITE_NAME, $messageText);
     $messageText = str_replace("[SITEURL]", $Url, $messageText);
     $messageText = str_replace("[ACTIVATIONLINK]", $ActivationLink, $messageText);
     if (IS_LIVE) {
         $retnvalue = SendEmail($dataForm['email_address'], $subject, $messageText);
     }
     return $UserId;
 }
开发者ID:ankuradhey,项目名称:dealtrip,代码行数:69,代码来源:Users.php

示例12: copyProperty

 public function copyProperty($ppty_no, $param1, $param2, $param3, $param4)
 {
     global $mySession;
     $db = new Db();
     $chkQuery = $db->runQuery("select * from " . PROPERTY . " where propertycode = '" . $ppty_no . "' ");
     //step1 is saved in database
     $data_update['propertycode'] = generate_property_no($mySession->LoggedUserId);
     $data_update['property_type'] = $chkQuery[0]['property_type'];
     $data_update['property_title'] = $chkQuery[0]['property_title'];
     //$data_update['telephone'] = $dataForm['telephone'];
     $data_update['website'] = $chkQuery[0]['website'];
     $data_update['brief_desc'] = $chkQuery[0]['brief_desc'];
     $data_update['country_id'] = $chkQuery[0]['country_id'];
     $data_update['state_id'] = $chkQuery[0]['state_id'];
     $data_update['city_id'] = $chkQuery[0]['city_id'];
     $data_update['sub_area_id'] = $chkQuery[0]['sub_area_id'];
     $data_update['local_area_id'] = $chkQuery[0]['local_area_id'];
     $data_update['zipcode'] = $chkQuery[0]['zipcode'];
     $data_update['date_added'] = date('Y-m-d');
     /* other details */
     $data_update['bedrooms'] = $chkQuery[0]['bedrooms'];
     $data_update['bathrooms'] = $chkQuery[0]['bathrooms'];
     $data_update['en_bedrooms'] = $chkQuery[0]['en_bedrooms'];
     $data_update['maximum_occupancy'] = $chkQuery[0]['maximum_occupancy'];
     $meta_keywords = $chkQuery[0]['property_title'] . ", " . $chkQuery[0]['bedrooms'] . " bedrooms, " . $chkQuery[0]['bathrooms'] . " bathrooms, " . $chkQuery[0]['property_type'] . ", " . $data_update['propertycode'];
     $meta_description = substr($chkQuery[0]['brief_desc'], 0, 200);
     $data_update['meta_keywords'] = addslashes($meta_keywords);
     $data_update['meta_description'] = addslashes($meta_description);
     //$data_update['status'] = '1';
     $data_update['star_rating'] = $chkQuery[0]['star_rating'];
     $data_update['user_id'] = $mySession->LoggedUserId;
     $data_update['status_2'] = $chkQuery[0]['status_2'];
     //prd($data_update);
     //step 3
     $data_update['big_desc'] = $chkQuery[0]['big_desc'];
     $data_update['amenity_ques'] = $chkQuery[0]['amenity_ques'];
     $data_update['airport1'] = $chkQuery[0]['airport1'];
     $data_update['airport2'] = $chkQuery[0]['airport2'];
     $data_update['distance_airport1'] = $chkQuery[0]['distance_airport1'];
     $data_update['distance_airport2'] = $chkQuery[0]['distance_airport2'];
     $data_update['status_3'] = $chkQuery[0]['status_3'];
     //step 4
     $data_update['cletitude'] = $chkQuery[0]['cletitude'];
     $data_update['clongitude'] = $chkQuery[0]['clongitude'];
     $data_update['address'] = $chkQuery[0]['address'];
     $data_update['status_4'] = $chkQuery[0]['status_4'];
     //step 5
     if ($chkQuery[0]['floor_plan'] != "") {
         $tmp_name = explode(".", $chkQuery[0]['floor_plan']);
         $randomname = "floorplan_" . $chkQuery[0]['user_id'] . "_" . time() . "." . $tmp_name[count($tmp_name) - 1];
         $chkQuery[0]['floor_plan'];
         copy(SITE_ROOT . "images/floorplan/" . $chkQuery[0]['floor_plan'], SITE_ROOT . "images/floorplan/" . $randomname);
         $data_update['floor_plan'] = $randomname;
     }
     //step 7
     $data_update['currency_code'] = $chkQuery[0]['currency_code'];
     //step 8
     $data_update['rental_ques'] = $chkQuery[0]['rental_ques'];
     //step 9
     $data_update['agent_person'] = $chkQuery[0]['agent_person'];
     $data_update['agent_name'] = $chkQuery[0]['agent_name'];
     $data_update['agent_phone'] = $chkQuery[0]['agent_phone'];
     $data_update['agent_address'] = $chkQuery[0]['agent_address'];
     $data_update['agent_email'] = $chkQuery[0]['agent_email'];
     $data_update['agent_website'] = $chkQuery[0]['agent_website'];
     $data_update['property_name'] = $chkQuery[0]['property_name'];
     $data_update['address1'] = $chkQuery[0]['address1'];
     $data_update['telephone'] = $chkQuery[0]['telephone'];
     $data_update['emergency_no'] = $chkQuery[0]['emergency_no'];
     $data_update['website'] = $chkQuery[0]['website'];
     $data_update['master_cal_url'] = $chkQuery[0]['master_cal_url'];
     /* instruction details */
     $data_update['directions_to_property'] = $chkQuery[0]['directions_to_property'];
     $data_update['late_arrival_instruction'] = $chkQuery[0]['late_arrival_instruction'];
     if ($chkQuery[0]['arrival_instruction'] != "") {
         $tmp_name = explode(".", $chkQuery[0]['arrival_instruction']);
         $randomname = $tmp_name[0] . date() . time() . "." . $tmp_name[count($tmp_name) - 1];
         copy(SITE_ROOT . "uploads/instructions/" . $chkQuery[0]['arrival_instruction'], SITE_ROOT . "uploads/instructions/" . $randomname);
         $data_update['arrival_instruction'] = $randomname;
     }
     if ($chkQuery[0]['arrival_instruction1'] != "") {
         $tmp_name = explode(".", $chkQuery[0]['arrival_instruction1']);
         $randomname = $tmp_name[0] . date() . time() . "." . $tmp_name[count($tmp_name) - 1];
         copy(SITE_ROOT . "uploads/instructions/" . $chkQuery[0]['arrival_instruction1'], SITE_ROOT . "uploads/instructions/" . $randomname);
         $data_update['arrival_instruction1'] = $randomname;
     }
     if ($chkQuery[0]['arrival_instruction2'] != "") {
         $tmp_name = explode(".", $chkQuery[0]['arrival_instruction2']);
         $randomname = $tmp_name[0] . date() . time() . "." . $tmp_name[count($tmp_name) - 1];
         copy(SITE_ROOT . "uploads/instructions/" . $chkQuery[0]['arrival_instruction2'], SITE_ROOT . "uploads/instructions/" . $randomname);
         $data_update['arrival_instruction2'] = $randomname;
     }
     $data_update['key_instructions'] = $chkQuery[0]['key_instructions'];
     $data_update['status_9'] = $chkQuery[0]['status_9'];
     $db->save(PROPERTY, $data_update);
     $mySession->property_id = $db->lastInsertId();
     $mySession->ppty_no = $data_update['propertycode'];
     //$mySession->step = '1';
     //COPY SPECIFICATION
     $specArr = $db->runQuery("select * from " . SPEC_ANS . " where property_id = '" . $chkQuery[0]['id'] . "' ");
//.........这里部分代码省略.........
开发者ID:ankuradhey,项目名称:dealtrip,代码行数:101,代码来源:Propertyintro.php

示例13: saveproductAction


//.........这里部分代码省略.........
                     $backImage = $dataForm['backimage'];
                     if ($dataForm['backimage'] != "") {
                         $backImage = time() . "_" . $backImage;
                         @rename(SITE_ROOT . 'images/tshirtdesigns/back/' . $dataForm['backimage'], SITE_ROOT . 'images/tshirtdesigns/back/' . $backImage);
                     }
                     // Back Highlighted
                     $backImageHeigh = $dataForm['backHeigh'];
                     if ($dataForm['backHeigh'] != "") {
                         $backImageHeigh = time() . "_BH_" . $backImageHeigh;
                         @rename(SITE_ROOT . 'images/tshirtdesigns/back/' . $dataForm['backHeigh'], SITE_ROOT . 'images/tshirtdesigns/back/' . $backImageHeigh);
                         $dataInsert['backHeigh'] = $backImageHeigh;
                     }
                     // Back Shadow
                     $backImageShadow = $dataForm['backShadow'];
                     if ($dataForm['backShadow'] != "") {
                         $backImageShadow = time() . "_BS_" . $backImageShadow;
                         @rename(SITE_ROOT . 'images/tshirtdesigns/back/' . $dataForm['backShadow'], SITE_ROOT . 'images/tshirtdesigns/back/' . $backImageShadow);
                         $dataInsert['backShadow'] = $backImageShadow;
                     }
                 }
                 if ($backImage != '' && $_REQUEST['checkData1'] == 'backimageData777') {
                     $dataInsert['backimage'] = $backImage;
                     $dataInsert['totalimage'] = '2';
                 } else {
                     $dataInsert['totalimage'] = '1';
                 }
                 $dataInsert['image'] = $profileImage;
                 $dataInsert['name'] = $dataForm['title'];
                 $dataInsert['colorcode'] = $dataForm['colorcode'];
                 $dataInsert['status'] = 1;
                 $dataInsert['date_added'] = date('y-m-d');
                 //error_log('saveproductAction, dataInsert: '.print_r($dataInsert, true));
                 $Result = $db->save(TSHIRT_PRODUCTS, $dataInsert);
                 $ProductIdKM = $db->lastInsertId();
                 //error_log('saveproductAction, $ProductIdKM: '.$ProductIdKM);
                 if ($Result > 0 && $ProductIdKM > 0) {
                     $dataInsertPrice['base_price'] = $dataForm['base_price'];
                     $dataInsertPrice['shipping_price'] = $dataForm['shippingprice'];
                     $dataInsertPrice['campagin_id'] = $ProductIdKM;
                     $db->save(TSHIRT_PRICE, $dataInsertPrice);
                     $mySession->errorMsg = "Added successfully.";
                 }
             } else {
                 // UPDATING ALREADY EXISTING PRODUCT
                 error_log('saveproductAction, UPDATING ALREADY EXISTING PRODUCT');
                 // Front
                 if ($dataForm['image'] != "" && $dataForm['oldicon'] != "") {
                     unlink(SITE_ROOT . 'images/tshirtdesigns/front/' . $dataForm['oldicon']);
                 }
                 $profileImage = $dataForm['oldicon'];
                 if ($dataForm['image'] != "") {
                     $profileImage = time() . "_" . $dataForm['image'];
                     @rename(SITE_ROOT . 'images/tshirtdesigns/front/' . $dataForm['image'], SITE_ROOT . 'images/tshirtdesigns/front/' . $profileImage);
                 }
                 if ($dataForm['frontHeigh'] != "" && $dataForm['oldfrontHeigh'] != "") {
                     unlink(SITE_ROOT . 'images/tshirtdesigns/front/' . $dataForm['oldfrontHeigh']);
                 }
                 $profileImageFH = $dataForm['oldfrontHeigh'];
                 if ($dataForm['frontHeigh'] != "") {
                     $profileImageFH = time() . "_FH_" . $dataForm['frontHeigh'];
                     @rename(SITE_ROOT . 'images/tshirtdesigns/front/' . $dataForm['frontHeigh'], SITE_ROOT . 'images/tshirtdesigns/front/' . $profileImageFH);
                     $dataInsert['frontHeigh'] = $profileImageFH;
                 }
                 if ($dataForm['frontShadow'] != "" && $dataForm['oldfrontHeigh'] != "") {
                     unlink(SITE_ROOT . 'images/tshirtdesigns/front/' . $dataForm['oldfrontHeigh']);
                 }
开发者ID:Alexeykolobov,项目名称:php,代码行数:67,代码来源:TshirtController.php

示例14: onrequestpayAction

 public function onrequestpayAction()
 {
     global $mySession;
     $db = new Db();
     $spclOffer = implode(",", $mySession->spclOfferId);
     $extras = implode(",", $mySession->extrasId);
     //$dataForm['property_id'] = $mySession->pptyId;
     $dataForm['property_id'] = $mySession->bookingUser['property_id'];
     $dataForm['user_id'] = $mySession->bookingUser['user_id'];
     $dataForm['date_from'] = date('Y-m-d', strtotime($mySession->arrivalDate));
     $dataForm['date_to'] = date('Y-m-d', strtotime($mySession->arrivalDate . " + " . $mySession->noOfNights . " day"));
     $dataForm['offer_id'] = $spclOffer;
     $dataForm['min_rate'] = $mySession->minrate;
     //$dataForm['extras_id'] = $extras;
     $dataForm['children'] = $mySession->Children;
     $dataForm['adult'] = $mySession->Adults;
     $dataForm['infants'] = $mySession->Infants;
     $dataForm['total'] = $mySession->Infants;
     $dataForm['rental_amt'] = $mySession->totalCost;
     $dataForm['booking_date'] = date('Y-m-d');
     $dataForm['booking_type'] = '1';
     $dataForm['paid_status'] = '0';
     $db->save(BOOKING, $dataForm);
     $bookingId = $db->lastInsertId();
     //code to save data in calendar table
     /*$dataForm = array();
     		
     		$dataForm['property_id'] = $mySession->pptyId;
     		$dataForm['date_from'] = date('Y-m-d',strtotime($mySession->arrivalDate));
     		$dataForm['date_to'] = date('Y-m-d',strtotime($mySession->arrivalDate." + ".$mySession->noOfNights." day"));
     		$dataForm['cal_status'] = '0';
     		
     		save_calendar_stat($mySession->pptyId,$dataForm['date_from'],$dataForm['date_to']);*/
     //saving in the booking extra table
     foreach ($mySession->extrasId as $values) {
         $extrasArr = $db->runQuery("select ename,eprice*exchange_rate as eprice,etype,stay_type from  " . EXTRAS . " \n\t\t\t                            inner join " . PROPERTY . " on " . PROPERTY . ".id = " . EXTRAS . ".property_id\n\t\t\t\t\t\t\t\t\t\tinner join " . CURRENCY . " on " . CURRENCY . ".currency_code = " . PROPERTY . ".currency_code\n\t\t\t\t\t\t\t\t\t\twhere eid = '" . $values . "'\t ");
         $dataForm = array();
         $dataForm['booking_id'] = $bookingId;
         $dataForm['option_name'] = $extrasArr[0]['ename'];
         $dataForm['option_price'] = $extrasArr[0]['eprice'];
         $dataForm['option_status'] = $extrasArr[0]['etype'];
         $dataForm['stay_type'] = $extrasArr[0]['stay_type'];
         $db->save(BOOKING_EXTRA, $dataForm);
     }
     //		$extrasArr = $db->runQuery("select ename,eprice*exchange_rate as eprice,etype,stay_type from  ".EXTRAS."
     //									inner join ".PROPERTY." on ".PROPERTY.".id = ".EXTRAS.".property_id
     //   								    inner join ".CURRENCY." on ".CURRENCY.".currency_code = ".PROPERTY.".currency_code
     //									where property_id = '".$mySession->pptyId."' and etype = '1' ");
     $extrasArr = $db->runQuery("select ename,eprice*exchange_rate as eprice,etype,stay_type from  " . EXTRAS . " \n\t\t\t\t\t\t\t\t\tinner join " . PROPERTY . " on " . PROPERTY . ".id = " . EXTRAS . ".property_id\n   \t\t\t\t\t\t\t\t    inner join " . CURRENCY . " on " . CURRENCY . ".currency_code = " . PROPERTY . ".currency_code\n\t\t\t\t\t\t\t\t\twhere property_id = '" . $mySession->bookingUser['property_id'] . "' and etype = '1' ");
     //saving for the compulosry extras table
     foreach ($extrasArr as $values) {
         $dataForm = array();
         $dataForm['booking_id'] = $bookingId;
         $dataForm['option_name'] = $values['ename'];
         $dataForm['option_price'] = $values['eprice'];
         $dataForm['option_status'] = $values['etype'];
         $dataForm['stay_type'] = $values['stay_type'];
         $db->save(BOOKING_EXTRA, $dataForm);
     }
     $mySession->sucessMsg = "Thank you.. Property has been Booked Successfully";
     $pptyno = $db->runQuery("select propertycode from  " . PROPERTY . " where id = '" . $mySession->pptyId . "' ");
     $fullName = $mySession->LoggedUserName;
     $Url = '<a href="' . APPLICATION_URL . '">' . APPLICATION_URL . '</a>';
     $templateData = $db->runQuery("select * from " . EMAIL_TEMPLATES . " where template_id='7'");
     $messageText = $templateData[0]['email_body'];
     $subject = $templateData[0]['email_subject'];
     $messageText = str_replace("[NAME]", $fullName, $messageText);
     $messageText = str_replace("[SITENAME]", SITE_NAME, $messageText);
     $messageText = str_replace("[SITEURL]", APPLICATION_URL, $messageText);
     $messageText = str_replace("[PROPERTYNO]", $pptyno[0]['propertycode'], $messageText);
     SendEmail($dataForm['email_address'], $subject, $messageText);
     __bookSessionClear();
     $this->_redirect("contents/pages/slug/bookingsucess");
 }
开发者ID:ankuradhey,项目名称:dealtrip,代码行数:74,代码来源:_BookingController.php

示例15: die

        default:
            die('Unsupported File Please upload txt file!');
            //output error
    }
} else {
    die('Something wrong with upload! Is "upload_max_filesize" set correctly?');
}
//if all files are uploaded correctly, following things happen, it is a part of validation
//get first three text fields and assign to variables
$lesson_name = filter_var($_POST["name"], FILTER_SANITIZE_STRING);
$description = filter_var($_POST["description"], FILTER_SANITIZE_STRING);
$lecturer = filter_var($_POST["lecturer"], FILTER_SANITIZE_STRING);
//insert text field values into lesson table
$lessons = $db->query("INSERT INTO lesson(name, description, lecture) VALUES (:nam,:des,:lec)", array("nam" => $lesson_name, "des" => $description, "lec" => $lecturer));
//get the id of last inserted row
$lessonID = $db->lastInsertId();
//upload files separately into the unique folder of the uploads folder
$UploadDirectory1 = '../../../data/uploaded_lessons/' . $lessonID . '/' . 'videos/';
$UploadDirectory2 = '../../../data/uploaded_lessons/' . $lessonID . '/' . 'slides/';
$UploadDirectory3 = '../../../data/uploaded_lessons/' . $lessonID . '/';
//get file name
$File_Name = strtolower($_FILES['FileInput1']['name']);
//rename video file always as 1.mp4
$NewFileName = "1.mp4";
//if not directly by above name create it.
if (!file_exists($UploadDirectory1)) {
    mkdir($UploadDirectory1, 0755, true);
}
//move temporary uploaded file into the folder created above
if (move_uploaded_file($_FILES['FileInput1']['tmp_name'], $UploadDirectory1 . $NewFileName)) {
    //  die('Success! File Uploaded.');
开发者ID:chamathsilva,项目名称:VideoBayV2.0,代码行数:31,代码来源:uploadLesson.php


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