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


PHP DatabaseConnection::InsertOrUpdate方法代码示例

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


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

示例1: Save

 /**
  * Saves the object to the database
  * @return integer $newsId
  */
 function Save()
 {
     $Database = new DatabaseConnection();
     $this->pog_query = "select `newsid` from `news` where `newsid`='" . $this->newsId . "' LIMIT 1";
     $Database->Query($this->pog_query);
     if ($Database->Rows() > 0) {
         $this->pog_query = "update `news` set \n\t\t\t`heading`='" . $Database->Escape($this->heading) . "', \n\t\t\t`description`='" . $Database->Escape($this->description) . "', \n\t\t\t`link`='" . $Database->Escape($this->link) . "', \n\t\t\t`live`='" . $Database->Escape($this->live) . "', \n\t\t\t`dt_created`='" . $Database->Escape($this->dt_created) . "' where `newsid`='" . $this->newsId . "'";
     } else {
         $this->pog_query = "insert into `news` (`heading`, `description`, `link`, `live`) values (\n\t\t\t'" . $Database->Escape($this->heading) . "', \n\t\t\t'" . $Database->Escape($this->description) . "', \n\t\t\t'" . $Database->Escape($this->link) . "', \n\t\t\t'" . $Database->Escape($this->live) . "' )";
     }
     $Database->InsertOrUpdate($this->pog_query);
     if ($this->newsId == "") {
         $this->newsId = $Database->GetCurrentId();
     }
     return $this->newsId;
 }
开发者ID:BackupTheBerlios,项目名称:scrapbook,代码行数:20,代码来源:class.news.php

示例2: Save

 /**
  * Saves the object to the database
  * @return integer $restaurantId
  */
 function Save()
 {
     $Database = new DatabaseConnection();
     $this->pog_query = "select `restaurantid` from `restaurant` where `restaurantid`='" . $this->restaurantId . "' LIMIT 1";
     $Database->Query($this->pog_query);
     if ($Database->Rows() > 0) {
         $this->pog_query = "update `restaurant` set \n\t\t\t`onlineuser_onlineuserid`='" . $Database->Escape($this->onlineuser_onlineuserid) . "', \n\t\t\t`logo`='" . $Database->Escape($this->logo) . "', \n\t\t\t`name`='" . $Database->Escape($this->name) . "', \n\t\t\t`description`='" . $Database->Escape($this->description) . "', \n\t\t\t`link`='" . $Database->Escape($this->link) . "', \n\t\t\t`tel`='" . $Database->Escape($this->tel) . "', \n\t\t\t`dt_created`='" . $Database->Escape($this->dt_created) . "', \n\t\t\t`dt_expire`='" . $Database->Escape($this->dt_expire) . "', \t\t\t\n\t\t\t`restaurant_status`='" . $this->restaurant_status . "' where `restaurantid`='" . $this->restaurantId . "'";
     } else {
         $this->pog_query = "insert into `restaurant` (`onlineuser_onlineuserid`, `logo`, `name`, `description`, `link`, `tel`, `dt_expire`, `restaurant_status` ) values (\n\t\t\t'" . $Database->Escape($this->onlineuser_onlineuserid) . "', \n\t\t\t'" . $Database->Escape($this->logo) . "', \n\t\t\t'" . $Database->Escape($this->name) . "', \n\t\t\t'" . $Database->Escape($this->description) . "', \n\t\t\t'" . $Database->Escape($this->link) . "', \n\t\t\t'" . $Database->Escape($this->tel) . "', \n\t\t\t'" . $Database->Escape($this->dt_expire) . "', \n\t\t\t'" . $this->restaurant_status . "' )";
     }
     $Database->InsertOrUpdate($this->pog_query);
     if ($this->restaurantId == "") {
         $this->restaurantId = $Database->GetCurrentId();
     }
     return $this->restaurantId;
 }
开发者ID:BackupTheBerlios,项目名称:scrapbook,代码行数:20,代码来源:class.restaurant.php

示例3: Save

 /**
  * Saves the object to the database
  * @return integer $platinum_membershipId
  */
 function Save()
 {
     $Database = new DatabaseConnection();
     $this->pog_query = "select `spotlightid` from `spotlight` where `spotlightid`='" . $this->spotlightId . "' LIMIT 1";
     $Database->Query($this->pog_query);
     if ($Database->Rows() > 0) {
         $this->pog_query = "update `spotlight` set \n\t\t\t`membershipId`='" . $Database->Escape($this->membershipId) . "', \n\t\t\t`logo`='" . $Database->Escape($this->logo) . "', \n\t\t\t`image1`='" . $Database->Escape($this->image1) . "', \n\t\t\t`image2`='" . $Database->Escape($this->image2) . "', \n\t\t\t`heading`='" . $Database->Escape($this->heading) . "', \n\t\t\t`text`='" . $Database->Escape($this->text) . "', \n\t\t\t`name`='" . $Database->Escape($this->name) . "', \n\t\t\t`address`='" . $Database->Escape($this->address) . "', \n\t\t\t`tel`='" . $Database->Escape($this->tel) . "', \n\t\t\t`fax`='" . $Database->Escape($this->fax) . "', \n\t\t\t`email`='" . $Database->Escape($this->email) . "', \n\t\t\t`link`='" . $Database->Escape($this->link) . "', \n\t\t\t`dt_created`='" . $Database->Escape($this->dt_created) . "', \n\t\t\t`spotlight_type`='" . $this->spotlight_type . "' where `spotlightid`='" . $this->spotlightId . "'";
     } else {
         $this->pog_query = "insert into `spotlight` (`membershipid`, `logo`, `image1`, `image2`, `heading`, `text`, `name`, `address`, `tel`, `fax`, `email`, `link`, `spotlight_type` ) values (\n\t\t\t'" . $Database->Escape($this->membershipId) . "', \n\t\t\t'" . $Database->Escape($this->logo) . "', \n\t\t\t'" . $Database->Escape($this->image1) . "', \n\t\t\t'" . $Database->Escape($this->image2) . "', \n\t\t\t'" . $Database->Escape($this->heading) . "', \n\t\t\t'" . $Database->Escape($this->text) . "', \n\t\t\t'" . $Database->Escape($this->name) . "', \n\t\t\t'" . $Database->Escape($this->address) . "', \n\t\t\t'" . $Database->Escape($this->tel) . "', \n\t\t\t'" . $Database->Escape($this->fax) . "', \n\t\t\t'" . $Database->Escape($this->email) . "', \n\t\t\t'" . $Database->Escape($this->link) . "', \n\t\t\t'" . $this->spotlight_type . "' )";
     }
     $Database->InsertOrUpdate($this->pog_query);
     if ($this->spotlightId == "") {
         $this->spotlightId = $Database->GetCurrentId();
     }
     return $this->spotlightId;
 }
开发者ID:BackupTheBerlios,项目名称:scrapbook,代码行数:20,代码来源:class.spotlight.php

示例4: Save

 /**
  * Saves the object to the database
  * @return integer $onlineuserId
  */
 function Save($updatePassword = false)
 {
     $Database = new DatabaseConnection();
     $this->pog_query = "select `onlineuserid` from `onlineuser` where `onlineuserid`='" . $this->onlineuserId . "' LIMIT 1";
     $Database->Query($this->pog_query);
     if ($Database->Rows() > 0) {
         $passwordSql = "'{$this->pass_word}'";
         if ($updatePassword) {
             $passwordSql = "PASSWORD('" . $this->pass_word . "')";
         }
         $this->pog_query = "update `onlineuser` set \n\t\t\t`email`='" . $Database->Escape($this->email) . "', \n\t\t\t`first_name`='" . $Database->Escape($this->first_name) . "', \n\t\t\t`last_name`='" . $Database->Escape($this->last_name) . "',`pass_word`=" . $passwordSql . ", \n\t\t\t`address_1`='" . $Database->Escape($this->address_1) . "', \n\t\t\t`address_2`='" . $Database->Escape($this->address_2) . "', \n\t\t\t`address_3`='" . $Database->Escape($this->address_3) . "', \n\t\t\t`postcode`='" . $Database->Escape($this->postcode) . "', \n\t\t\t`tel`='" . $Database->Escape($this->tel) . "', \n\t\t\t`fax`='" . $Database->Escape($this->fax) . "', \n\t\t\t`dt_created`='" . $Database->Escape($this->dt_created) . "', \n\t\t\t`user_status`='" . $this->user_status . "' where `onlineuserid`='" . $this->onlineuserId . "'";
     } else {
         $this->pog_query = "insert into `onlineuser` (`email`, `first_name`, `last_name`, `pass_word`, `address_1`, `address_2`, `address_3`, `postcode`, `tel`, `fax`, `user_status` ) values (\n\t\t\t'" . $Database->Escape($this->email) . "', \n\t\t\t'" . $Database->Escape($this->first_name) . "', \n\t\t\t'" . $Database->Escape($this->last_name) . "', \n\t\t\tPASSWORD('" . $this->pass_word . "'), \n\t\t\t'" . $Database->Escape($this->address_1) . "', \n\t\t\t'" . $Database->Escape($this->address_2) . "', \n\t\t\t'" . $Database->Escape($this->address_3) . "', \n\t\t\t'" . $Database->Escape($this->postcode) . "', \n\t\t\t'" . $Database->Escape($this->tel) . "', \n\t\t\t'" . $Database->Escape($this->fax) . "',  \n\t\t\t'" . $this->user_status . "' )";
     }
     $Database->InsertOrUpdate($this->pog_query);
     if ($this->onlineuserId == "") {
         $this->onlineuserId = $Database->GetCurrentId();
     }
     return $this->onlineuserId;
 }
开发者ID:BackupTheBerlios,项目名称:scrapbook,代码行数:24,代码来源:class.onlineuser.php

示例5: Save

 /**
  * Saves the object to the database
  * @return integer $userId
  */
 function Save()
 {
     $Database = new DatabaseConnection();
     $this->pog_query = "select userid from `user` where `userid`='" . $this->userId . "' LIMIT 1";
     $Database->Query($this->pog_query);
     if ($Database->Rows() > 0) {
         $this->pog_query = "update `user` set \r\n\t\t\t`username`='" . $Database->Escape($this->username) . "', \r\n\t\t\t`password`='" . $Database->Escape($this->password) . "', \r\n\t\t\t`firstname`='" . $Database->Escape($this->firstname) . "', \r\n\t\t\t`lastname`='" . $Database->Escape($this->lastname) . "', \r\n\t\t\t`question`='" . $Database->Escape($this->question) . "', \r\n\t\t\t`answer`='" . $Database->Escape($this->answer) . "', \r\n\t\t\t`groupid`='" . $this->groupId . "', \r\n\t\t\t`lastlogin`='" . $Database->Escape($this->lastlogin) . "', \r\n\t\t\t`disabled`='" . $Database->Escape($this->disabled) . "' where `userid`='" . $this->userId . "'";
     } else {
         $this->pog_query = "insert into `user` (`username`, `password`, `firstname`, `lastname`, `question`, `answer`, `groupid`, `lastlogin`, `disabled` ) values (\r\n\t\t\t'" . $Database->Escape($this->username) . "', \r\n\t\t\t'" . $Database->Escape($this->password) . "', \r\n\t\t\t'" . $Database->Escape($this->firstname) . "', \r\n\t\t\t'" . $Database->Escape($this->lastname) . "', \r\n\t\t\t'" . $Database->Escape($this->question) . "', \r\n\t\t\t'" . $Database->Escape($this->answer) . "', \r\n\t\t\t'" . $this->groupId . "', \r\n\t\t\t'" . $Database->Escape($this->lastlogin) . "', \r\n\t\t\t'" . $Database->Escape($this->disabled) . "' )";
     }
     $Database->InsertOrUpdate($this->pog_query);
     if ($this->userId == "") {
         $this->userId = $Database->GetCurrentId();
     }
     return $this->userId;
 }
开发者ID:dreamvishnu,项目名称:tire-inventory,代码行数:20,代码来源:class.user.php

示例6: Save

 /**
  * Saves the object to the database
  * @return integer $customerId
  */
 function Save()
 {
     $Database = new DatabaseConnection();
     $this->pog_query = "select customerid from `customer` where `customerid`='" . $this->customerId . "' LIMIT 1";
     $Database->Query($this->pog_query);
     if ($Database->Rows() > 0) {
         $this->pog_query = "update `customer` set \r\n\t\t\t`company`='" . $Database->Escape($this->company) . "', \r\n\t\t\t`firstname`='" . $Database->Escape($this->firstname) . "', \r\n\t\t\t`lastname`='" . $Database->Escape($this->lastname) . "', \r\n\t\t\t`address1`='" . $Database->Escape($this->address1) . "', \r\n\t\t\t`address2`='" . $Database->Escape($this->address2) . "', \r\n\t\t\t`city`='" . $Database->Escape($this->city) . "', \r\n\t\t\t`mobile`='" . $Database->Escape($this->mobile) . "', \r\n\t\t\t`landline`='" . $Database->Escape($this->landline) . "', \r\n\t\t\t`email`='" . $Database->Escape($this->email) . "', \r\n\t\t\t`limit`='" . $Database->Escape($this->limit) . "', \r\n\t\t\t`available`='" . $Database->Escape($this->available) . "', \r\n\t\t\t`deleted`='" . $Database->Escape($this->deleted) . "' where `customerid`='" . $this->customerId . "'";
     } else {
         $this->pog_query = "insert into `customer` (`company`, `firstname`, `lastname`, `address1`, `address2`, `city`, `mobile`, `landline`, `email`, `limit`, `available`, `deleted` ) values (\r\n\t\t\t'" . $Database->Escape($this->company) . "', \r\n\t\t\t'" . $Database->Escape($this->firstname) . "', \r\n\t\t\t'" . $Database->Escape($this->lastname) . "', \r\n\t\t\t'" . $Database->Escape($this->address1) . "', \r\n\t\t\t'" . $Database->Escape($this->address2) . "', \r\n\t\t\t'" . $Database->Escape($this->city) . "', \r\n\t\t\t'" . $Database->Escape($this->mobile) . "', \r\n\t\t\t'" . $Database->Escape($this->landline) . "', \r\n\t\t\t'" . $Database->Escape($this->email) . "', \r\n\t\t\t'" . $Database->Escape($this->limit) . "', \r\n\t\t\t'" . $Database->Escape($this->available) . "', \r\n\t\t\t'" . $Database->Escape($this->deleted) . "' )";
     }
     $Database->InsertOrUpdate($this->pog_query);
     if ($this->customerId == "") {
         $this->customerId = $Database->GetCurrentId();
     }
     return $this->customerId;
 }
开发者ID:dreamvishnu,项目名称:tire-inventory,代码行数:20,代码来源:class.customer.php

示例7: Save

 /**
  * Saves the object to the database
  * @return integer $supplierId
  */
 function Save()
 {
     $Database = new DatabaseConnection();
     $this->pog_query = "select supplierid from `supplier` where `supplierid`='" . $this->supplierId . "' LIMIT 1";
     $Database->Query($this->pog_query);
     if ($Database->Rows() > 0) {
         $this->pog_query = "update `supplier` set \r\n\t\t\t`company`='" . $Database->Escape($this->company) . "', \r\n\t\t\t`address1`='" . $Database->Escape($this->address1) . "', \r\n\t\t\t`address2`='" . $Database->Escape($this->address2) . "', \r\n\t\t\t`city`='" . $Database->Escape($this->city) . "', \r\n\t\t\t`phone`='" . $Database->Escape($this->phone) . "', \r\n\t\t\t`contactname`='" . $Database->Escape($this->contactname) . "', \r\n\t\t\t`contactno`='" . $Database->Escape($this->contactno) . "', \r\n\t\t\t`deleted`='" . $Database->Escape($this->deleted) . "' where `supplierid`='" . $this->supplierId . "'";
     } else {
         $this->pog_query = "insert into `supplier` (`company`, `address1`, `address2`, `city`, `phone`, `contactname`, `contactno`, `deleted` ) values (\r\n\t\t\t'" . $Database->Escape($this->company) . "', \r\n\t\t\t'" . $Database->Escape($this->address1) . "', \r\n\t\t\t'" . $Database->Escape($this->address2) . "', \r\n\t\t\t'" . $Database->Escape($this->city) . "', \r\n\t\t\t'" . $Database->Escape($this->phone) . "', \r\n\t\t\t'" . $Database->Escape($this->contactname) . "', \r\n\t\t\t'" . $Database->Escape($this->contactno) . "', \r\n\t\t\t'" . $Database->Escape($this->deleted) . "' )";
     }
     $Database->InsertOrUpdate($this->pog_query);
     if ($this->supplierId == "") {
         $this->supplierId = $Database->GetCurrentId();
     }
     return $this->supplierId;
 }
开发者ID:dreamvishnu,项目名称:tire-inventory,代码行数:20,代码来源:class.supplier.php

示例8: Save

 /**
  * Saves the object to the database
  * @return integer $statsId
  */
 function Save()
 {
     $Database = new DatabaseConnection();
     $this->pog_query = "select `statsid` from `stats` where `statsid`='" . $this->statsId . "' LIMIT 1";
     $Database->Query($this->pog_query);
     if ($Database->Rows() > 0) {
         $this->pog_query = "update `stats` set \n\t\t\t`objectname`='" . $Database->Escape($this->objectname) . "', \n\t\t\t`objectid`='" . $Database->Escape($this->objectid) . "', \n\t\t\t`impressions`='" . $Database->Escape($this->impressions) . "', \n\t\t\t`clicks`='" . $Database->Escape($this->clicks) . "' where `statsid`='" . $this->statsId . "'";
     } else {
         $this->pog_query = "insert into `stats` (`objectname`, `objectid`, `impressions`, `clicks`) values (\n\t\t\t'" . $Database->Escape($this->objectname) . "', \n\t\t\t'" . $Database->Escape($this->objectid) . "', \n\t\t\t'" . $Database->Escape($this->impressions) . "', \n\t\t\t'" . $Database->Escape($this->clicks) . "' )";
     }
     $Database->InsertOrUpdate($this->pog_query);
     if ($this->statsId == "") {
         $this->statsId = $Database->GetCurrentId();
     }
     return $this->statsId;
 }
开发者ID:BackupTheBerlios,项目名称:scrapbook,代码行数:20,代码来源:class.stats.php

示例9: Save

 /**
  * Saves the object to the database
  * @return integer $groupId
  */
 function Save($deep = true)
 {
     $Database = new DatabaseConnection();
     $this->pog_query = "select groupid from `group` where `groupid`='" . $this->groupId . "' LIMIT 1";
     $Database->Query($this->pog_query);
     if ($Database->Rows() > 0) {
         $this->pog_query = "update `group` set \r\n\t\t\t`name`='" . $Database->Escape($this->name) . "', \r\n\t\t\t`desc`='" . $Database->Escape($this->desc) . "'where `groupid`='" . $this->groupId . "'";
     } else {
         $this->pog_query = "insert into `group` (`name`, `desc`) values (\r\n\t\t\t'" . $Database->Escape($this->name) . "', \r\n\t\t\t'" . $Database->Escape($this->desc) . "')";
     }
     $Database->InsertOrUpdate($this->pog_query);
     if ($this->groupId == "") {
         $this->groupId = $Database->GetCurrentId();
     }
     if ($deep) {
         $userList = $this->GetUserList();
         foreach ($this->_userList as $user) {
             $user->Save($deep);
         }
     }
     return $this->groupId;
 }
开发者ID:dreamvishnu,项目名称:tire-inventory,代码行数:26,代码来源:class.group.php

示例10: Save

 /**
  * Saves the object to the database
  * @return integer $supplier_categoryId
  */
 function Save()
 {
     $Database = new DatabaseConnection();
     $this->pog_query = "select `supplier_category_id` from `supplier_category` where `supplier_category_id`='" . $this->supplier_categoryId . "' LIMIT 1";
     $Database->Query($this->pog_query);
     if ($Database->Rows() > 0) {
         $this->pog_query = "update `supplier_category` set \n\t\t\t`name`='" . $Database->Escape($this->name) . "' where `supplier_category_id`='" . $this->supplier_categoryId . "'";
     } else {
         $this->pog_query = "insert into `supplier_category` (`name` ) values (\n\t\t\t'" . $Database->Escape($this->name) . "' )";
     }
     $Database->InsertOrUpdate($this->pog_query);
     if ($this->supplier_categoryId == "") {
         $this->supplier_categoryId = $Database->GetCurrentId();
     }
     return $this->supplier_categoryId;
 }
开发者ID:BackupTheBerlios,项目名称:scrapbook,代码行数:20,代码来源:class.supplier_category.php


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