本文整理汇总了PHP中Db::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Db::save方法的具体用法?PHP Db::save怎么用?PHP Db::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Db
的用法示例。
在下文中一共展示了Db::save方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Addphoto
public function Addphoto($dataForm, $photoId = '')
{
global $mySession;
$db = new Db();
if ($dataForm['photo_path2'] != "") {
$photoname = explode('.', $dataForm['photo_path2']);
$len = count($photoname);
$extension = $photoname[$len - 1];
$datetime = date(d . m . y_h . i . s);
$new_name = $datetime . '.' . $extension;
rename(SITE_ROOT . 'photo/' . $dataForm['photo_path2'], SITE_ROOT . 'photo/' . $new_name);
$data_update['photo_path'] = $new_name;
}
$data_update['photo_title'] = $dataForm['photo_title'];
$data_update['photo_description'] = $dataForm['photo_description'];
$data_update['photo_status'] = $dataForm['photo_status'];
$data_update['website_id'] = $mySession->WebsiteId;
if ($photoId != "") {
$condition = 'photo_id=' . $photoId;
$result = $db->modify(PHOTO, $data_update, $condition);
} else {
$result = $db->save(PHOTO, $data_update);
}
return 1;
}
示例2: 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;
}
}
示例3: Savesubcategory
public function Savesubcategory($dataForm)
{
//echo 'hello'; exit();
global $mySession;
$db = new Db();
$dataForm = SetupMagicQuotes($dataForm);
// echo $sql="select * from ".SERVICE_CATEGORIES." where cat_id='".$dataForm['category']."'";exit();
// $catedata=$db->runQuery($sql);
//$cateid=$catedata[0]['cat_id'];
// echo "select * from ".SUBCATE." where subcate_name='".$dataForm['subcate_name']."' and cat_id=".$dataForm['category'];exit();
$chkQry = $db->runQuery("select * from " . SUBCATE . " where subcate_name='" . $dataForm['subcate_name'] . "' and cat_id=" . $dataForm['category']);
if ($chkQry != "" and count($chkQry) > 0) {
return 0;
} else {
if ($dataForm['subcate_image'] != "") {
$SubCatImage = time() . "_" . $dataForm['subcate_image'];
@rename(SITE_ROOT . 'images/Subcate/' . $dataForm['subcate_image'], SITE_ROOT . 'images/Subcate/' . $SubCatImage);
$dataInsert['subcate_img_path'] = $SubCatImage;
}
$dataInsert['subcate_name'] = $dataForm['subcate_name'];
$dataInsert['cat_id'] = $dataForm['category'];
$dataInsert['subcate_status'] = '0';
// prd($dataInsert);
$db->save(SUBCATE, $dataInsert);
return 1;
}
}
示例4: 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;
}
}
}
示例5: SaveThread
public function SaveThread($dataForm)
{
global $mySession;
$db = new Db();
$db->save(FORUM_THREADS, $dataForm);
return 1;
}
示例6: Addvideo
public function Addvideo($dataForm, $videoId = '')
{
global $mySession;
$db = new Db();
$data_update['video_type'] = $dataForm['video_type'];
if ($dataForm['video_path1'] != "") {
$data_update['video_path'] = $dataForm['video_path1'];
} else {
if ($dataForm['video_path2'] != "") {
$videoname = explode('.', $dataForm['video_path2']);
$len = count($videoname);
$extension = $videoname[$len - 1];
$datetime = date(d . m . y_h . i . s);
$new_name = $datetime . '.' . $extension;
rename(SITE_ROOT . 'video/' . $dataForm['video_path2'], SITE_ROOT . 'video/' . $new_name);
$data_update['video_path'] = $new_name;
}
}
$data_update['video_title'] = $dataForm['video_title'];
$data_update['video_description'] = $dataForm['video_description'];
$data_update['video_status'] = $dataForm['video_status'];
$data_update['featured_status'] = $dataForm['featured_status'];
$data_update['website_id'] = $mySession->WebsiteId;
if ($videoId != "") {
//print_r($data_update);die;
$condition = 'video_id=' . $videoId;
$result = $db->modify(VIDEO, $data_update, $condition);
} else {
$result = $db->save(VIDEO, $data_update);
}
return 1;
}
示例7: saveSpeccat
public function saveSpeccat($dataForm, $cId = "")
{
global $mySession;
$db = new Db();
if ($cId == "") {
$chkQry = $db->runQuery("select * from " . PROPERTY_SPEC_CAT . " where cat_name = '" . mysql_escape_string(trim($dataForm['category'])) . "' ");
if ($chkQry != "" and count($chkQry) > 0) {
return 0;
} else {
$data_update['cat_name'] = $dataForm['category'];
$data_update['cat_status'] = $dataForm['status'];
$db->save(PROPERTY_SPEC_CAT, $data_update);
return 1;
}
} else {
$chkQry = $db->runQuery("select * from " . PROPERTY_SPEC_CAT . " where cat_name = '" . mysql_escape_string(trim($dataForm['category'])) . "' and cat_id != '" . $cId . "'");
if ($chkQry != "" and count($chkQry) > 0) {
//if Property Type Name is exists than return false / 0
// No Data Inserted
return 0;
} else {
$data_update['cat_name'] = $dataForm['category'];
$data_update['cat_status'] = $dataForm['status'];
$condition = " cat_id = " . $cId;
$result = $db->modify(PROPERTY_SPEC_CAT, $data_update, $condition);
return 1;
}
}
}
示例8: Saveclassified
public function Saveclassified($dataForm)
{
global $mySession;
$db = new Db();
$dataForm = SetupMagicQuotes($dataForm);
$chkQry = $db->runQuery("select * from " . CLASSIFIED . " where c_name='" . $dataForm['c_name'] . "' and cat_id=" . $dataForm['cat_id']);
if ($chkQry != "" and count($chkQry) > 0) {
return 0;
} else {
$date1 = date('Y-m-d');
$dataInsert['c_name'] = $dataForm['c_name'];
$dataInsert['cat_id'] = $dataForm['cat_id'];
$dataInsert['price'] = $dataForm['price'];
$dataInsert['location'] = $dataForm['location'];
$dataInsert['description'] = $dataForm['description'];
$dataInsert['zipcode'] = $dataForm['zipcode'];
$dataInsert['date_posted'] = $date1;
if ($mySession->LoggedUserId == 0 && $mySession->LoggedUserId == "") {
$dataInsert['user_id'] = 0;
}
// prd($dataInsert);
$db->save(CLASSIFIED, $dataInsert);
return 1;
}
}
示例9: savereview
public function savereview($dataForm, $ptyleId = "")
{
global $mySession;
$db = new Db();
if ($ptyleId == "") {
$data_update['review'] = $dataForm['review'];
$data_update['comment'] = $dataForm['comment'];
$data_update['review_status'] = $dataForm['status'];
$db->save(OWNER_REVIEW, $data_update);
return 1;
} else {
$data_update = array();
$data_update['guest_name'] = $dataForm['full_name'];
$data_update['location'] = $dataForm['location'];
// $data_update['review_date'] = $dataForm['check_in'];
$data_update['check_in'] = $dataForm['check_in'];
$data_update['review'] = $dataForm['review'];
$data_update['rating'] = $dataForm['rating'];
$data_update['headline'] = $dataForm['headline'];
$data_update['comment'] = $dataForm['comment'];
$data_update['review_status'] = $dataForm['status'];
$condition = " review_id = '" . $ptyleId . "' ";
$result = $db->modify(OWNER_REVIEW, $data_update, $condition);
return 1;
}
}
示例10: saveProtype
public function saveProtype($dataForm, $ptyleId = "")
{
global $mySession;
$db = new Db();
$data_update['ptyle_name'] = $dataForm['ptyle_name'];
if ($ptyleId == "") {
$chkQry = $db->runQuery("select * from " . PROPERTYTYPE . " where ptyle_name='" . mysql_escape_string(trim($dataForm['ptyle_name'])) . "'");
if ($chkQry != "" and count($chkQry) > 0) {
//if Property Type Name is exists than return false / 0
// No Data Inserted
return 0;
} else {
# If Property Type Name Not Already Exista.
# Insert New Record Into Database
$db->save(PROPERTYTYPE, $data_update);
return 1;
}
} else {
$chkQry = $db->runQuery("select * from " . PROPERTYTYPE . " where ptyle_name='" . mysql_escape_string(trim($dataForm['ptyle_name'])) . "' and ptyle_id!=" . $ptyleId);
if ($chkQry != "" and count($chkQry) > 0) {
return 0;
} else {
$condition = 'ptyle_id=' . $ptyleId;
$result = $db->modify(PROPERTYTYPE, $data_update, $condition);
return 1;
}
}
}
示例11: SaveThread
public function SaveThread($dataForm, $thread_userId)
{
global $mySession;
$db = new Db();
$Datainsert['topic_id'] = $dataForm['topic_id'];
$Datainsert['thread_id'] = $dataForm['thread_id'];
$Datainsert['replyof'] = $dataForm['replyof'];
$Datainsert['user_id'] = $dataForm['user_id'];
$Datainsert['date_posted'] = $dataForm['date_added'];
$Datainsert['post_text'] = $dataForm['post_text'];
$db->save(FORUM_POSTS, $Datainsert);
$threadcommentuser = $db->runQuery("select * from " . FORUM_POSTS . " AS TP inner join " . USERS . " AS U \n\t\t\t\t\t\t\t\tON TP.user_id=U.user_id where TP.user_id=" . $dataForm['user_id'] . "");
$comment_user = $threadcommentuser[0]['first_name'] . $threadcommentuser[0]['last_name'];
$userData = $db->runQuery("select * from " . FORUM_THREADS . " AS T inner join " . USERS . " AS U \n\t\t\t\t\t\t\t\tON T.user_id=U.user_id where T.thread_id=" . $dataForm['thread_id'] . "");
$fullName = $userData[0]['first_name'] . $userData[0]['last_name'];
$commentuser = $comment_user;
$useremail = $userData[0]['email_address'];
$threadtitle = $userData[0]['thread_text'];
$templateData = $db->runQuery("select * from " . EMAIL_TEMPLATES . " where template_id='5'");
$messageText = $templateData[0]['email_body'];
$subject = $templateData[0]['email_subject'];
$messageText = str_replace("[USERNAME]", $fullName, $messageText);
$messageText = str_replace("[THREADTITLE]", $threadtitle, $messageText);
$messageText = str_replace("[COMMENTUSERNAME]", $commentuser, $messageText);
$messageText = str_replace("[SITENAME]", SITE_NAME, $messageText);
SendEmail($useremail, $subject, $messageText);
return 1;
}
示例12: saveCurrency
public function saveCurrency($dataForm, $currencyId = "")
{
global $mySession;
$db = new Db();
$data_update['currency_name'] = trim($dataForm['currency_name']);
$data_update['currency_code'] = strtoupper(trim($dataForm['currency_code']));
$data_update['exchange_rate'] = $dataForm['exchange_rate'];
$maxquery = $db->runQuery("select max(currency_order) as MAX from " . CURRENCY . " ");
if ($currencyId == "") {
$currencyId = 0;
}
$chkQry2 = $db->runQuery("select * from " . CURRENCY . " where currency_code='" . mysql_escape_string(trim($data_update['currency_code'])) . "' and currency_id!=" . $currencyId);
if ($chkQry != "" and count($chkQry) > 0) {
return 0;
} else {
if ($currencyId > 0) {
$condition = 'currency_id=' . $currencyId;
$db->modify(CURRENCY, $data_update, $condition);
return 1;
} else {
$data_update['currency_order'] = $maxquery[0]['MAX'] + 1;
$db->save(CURRENCY, $data_update);
return 1;
}
}
}
示例13: SavePost
public function SavePost($dataForm)
{
//echo "hello"; exit();
global $mySession;
$db = new Db();
prd($dataForm);
$db->save(BLOG_POST, $dataForm);
return 1;
}
示例14: SaveThread
public function SaveThread($dataForm)
{
global $mySession;
$db = new Db();
//print_r($dataForm);die;
$Datainsert['topic_id'] = $dataForm['topic_id'];
$Datainsert['user_id'] = $dataForm['user_id'];
$Datainsert['date_added'] = $dataForm['date_added'];
$Datainsert['thread_text'] = $dataForm['thread_text'];
$db->save(FORUM_THREADS, $Datainsert);
return 1;
}
示例15: SavePackage
public function SavePackage($dataForm)
{
global $mySession;
$db = new Db();
$dataInsert['plan_name'] = $dataForm['plan_name'];
$dataInsert['plan_type'] = $dataForm['option'];
$dataInsert['plan_duration'] = $dataForm['plan_duration'];
$dataInsert['plan_price'] = $dataForm['plan_price'];
$dataInsert['plan_status'] = $dataForm['plan_status'];
$dataInsert['package_date'] = date('Y-m-d H:i:s');
$db->save(PACKAGES, $dataInsert);
return 1;
}