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


PHP Db类代码示例

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


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

示例1: getlastThread

 public function getlastThread($topic_id)
 {
     global $mySession;
     $db = new Db();
     $forumThread = $db->runQuery("select * from " . FORUM_THREADS . " inner join " . USERS . " on " . USERS . ".user_id = " . FORUM_THREADS . ".user_id where topic_id=" . $topic_id . " order by thread_id desc limit 1");
     return $forumThread;
 }
开发者ID:ankuradhey,项目名称:dealtrip,代码行数:7,代码来源:Threads.php

示例2: deleteCurrency

 public function deleteCurrency($currencyId)
 {
     global $mySession;
     $db = new Db();
     $condition1 = "currency_id='" . $currencyId . "'";
     $db->delete(CURRENCY, $condition1);
 }
开发者ID:ankuradhey,项目名称:dealtrip,代码行数:7,代码来源:Currencies.php

示例3: init

 public function init()
 {
     global $mySession;
     $db = new Db();
     $emailid_val = "";
     $qur = $db->runquery("SELECT * FROM  " . USERS . " WHERE user_id='" . $mySession->TeeLoggedID . "' ");
     //$qur=$db->runquery("select * from ".ADDRESS." join ".STATE." on ".STATE.".state_id=".ADDRESS.".state where user_id='".$mySession->TeeLoggedID."' ");
     if ($qur != "" and count($qur) > 0) {
         $emailid_val = $qur[0]['emailid'];
     }
     # FORM ELEMENT:public name
     # TYPE : text
     $emailid = new Zend_Form_Element_Text('emailid');
     $emailid->setRequired(true)->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib('class', 'changeaddress')->setAttrib('readonly', 'readonly')->setAttrib("style", "width:300px; height:30px;")->setValue($emailid_val);
     # FORM ELEMENT:address
     # TYPE : text
     $friendsemailid = new Zend_Form_Element_Text('friendsemailid');
     $friendsemailid->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'One id is required'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("style", "width:300px; height:30px;")->setAttrib('class', 'changepasstextbox');
     //if(@$_REQUEST['friendsemailid']!="")
     //		{
     //		$friendsemailid-> addValidator('EmailAddress', true)
     //		->addDecorator('Errors', array('class'=>'errmsg'))
     //		->addErrorMessage('Please enter a valid email address');
     //		}
     //
     # FORM ELEMENT:city
     # TYPE : text
     $url = new Zend_Form_Element_Text('url');
     $url->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'URL is required'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib('class', 'changeaddress')->setAttrib("style", "width:100px; height:30px;");
     $this->addElements(array($emailid, $friendsemailid, $url));
 }
开发者ID:Alexeykolobov,项目名称:php,代码行数:31,代码来源:Referfriends.php

示例4: init

 public function init()
 {
     global $mySession;
     $db = new Db();
     $ConfigData = $db->runQuery("select * from " . ADMINISTRATOR . " where admin_id='1'");
     $SiteTitle = $ConfigData[0]['site_title'];
     $MetaDescription = $ConfigData[0]['site_description'];
     $MetaKeyword = $ConfigData[0]['site_keyword'];
     $AdminEmail = $ConfigData[0]['admin_email'];
     $PaypalEmail = $ConfigData[0]['paypal_email'];
     $welcomemessageC = $ConfigData[0]['welcomemessage'];
     $admin_name_value = $ConfigData[0]['admin_fullname'];
     $site_title = new Zend_Form_Element_Text('site_title');
     $site_title->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Site title is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setValue($SiteTitle);
     $admin_name = new Zend_Form_Element_Text('admin_name');
     $admin_name->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Admin name is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setValue($admin_name_value);
     $site_description = new Zend_Form_Element_Text('site_description');
     $site_description->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Site description is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setValue($MetaDescription);
     $site_keyword = new Zend_Form_Element_Text('site_keyword');
     $site_keyword->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Site keyword is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setValue($MetaKeyword);
     $admin_email = new Zend_Form_Element_Text('admin_email');
     $admin_email->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Administrator email is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required email")->setValue($AdminEmail);
     $paypal_email = new Zend_Form_Element_Text('paypal_email');
     $paypal_email->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Paypal email address is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required email")->setValue($PaypalEmail);
     /*$currency_symbol= new Zend_Form_Element_Text('currency_symbol');
     		$currency_symbol->setRequired(true)
     		->addValidator('NotEmpty',true,array('messages' =>'Currency symbol is required.'))
     		->addDecorator('Errors', array('class'=>'error'))
     		->setAttrib("class","required")
     		->setValue($CurrencySymbol);*/
     $welcomemessage = new Zend_Form_Element_Textarea('welcomemessage');
     $welcomemessage->setAttrib("id", "elrte")->setAttrib("cols", "auto")->setAttrib("rows", "auto")->setValue($welcomemessageC);
     $this->addElements(array($site_title, $admin_name, $site_description, $site_keyword, $admin_email, $paypal_email, $welcomemessage));
 }
开发者ID:ankuradhey,项目名称:dealtrip,代码行数:34,代码来源:Configuration.php

示例5: __construct

 public function __construct(Db $db, $name)
 {
     $this->db = $db;
     $this->name = $name;
     $this->usedColumns = $db->getTableColumns($name) ?: [];
     $this->isColumnUsageReportingEnabled = empty($this->usedColumns);
 }
开发者ID:sharkodlak,项目名称:fluentdb,代码行数:7,代码来源:Table.php

示例6: getsingletemple

 public function getsingletemple()
 {
     $db = new Db();
     $id = $_POST['temple_id'];
     $results = $db->gettempleDetails($id);
     echo json_encode($results);
 }
开发者ID:sathyabaman,项目名称:PDO-Script,代码行数:7,代码来源:getTempleDetails.php

示例7: 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;
 }
开发者ID:ankuradhey,项目名称:dealtrip,代码行数:25,代码来源:Photo.php

示例8: getUsers

 public function getUsers($restId)
 {
     $db = new Db();
     $table = "rest" . $restId . "_users";
     $checkRest = restExists($table);
     if ($checkRest != true) {
         return $checkRest;
     }
     $local_query = "SELECT * FROM `{$table}`";
     $result = $db->select($local_query);
     $userCount = count($result);
     $configurationTable = "rest" . $restId . "_userConfigurations";
     $configurationMappingTable = "rest" . $restId . "_userConfigurationMapping";
     $userTable = "rest" . $restId . "_users";
     $local_query = "SELECT M.`userID`,M.`configurationID`, C.`configurationName`,C.`configurationDisplayText`, C.`configurationType`, \n\t\tC.`configurationTag`, C.`configurationValueBinary`, C.`configurationValueText`, C.`configurationValueDecimal`, C.`comments`,M.`isAllowed` FROM \n\t\t`{$configurationMappingTable}` AS M INNER JOIN `{$configurationTable}` AS C ON `M`.`configurationID` = `C`.`configurationID`  \n\t\tORDER BY   M.`userID`, M.`configurationID`";
     $resultConfiguration = $db->select($local_query);
     $configurationCount = count($resultConfiguration);
     for ($i = 0; $i < $userCount; $i++) {
         $result[$i]['Permissions'] = array();
         for ($j = 0; $j < $configurationCount; $j++) {
             if ($result[$i]['ID'] == $resultConfiguration[$j]['userID']) {
                 array_push($result[$i]['Permissions'], $resultConfiguration[$j]);
             }
         }
     }
     for ($i = 0; $i < $userCount; $i++) {
         for ($j = 0; $j <= count($result[$i]['Permissions']); $j++) {
             unset($result[$i]['Permissions'][$j]['userID']);
         }
     }
     $response = array();
     $response["Users"] = $result;
     return $response;
 }
开发者ID:veron123,项目名称:BaseW,代码行数:34,代码来源:UsersClass.php

示例9: games

 /**
  * Example of an Endpoint
  */
 protected function games($_args)
 {
     // var_dump($this->method);
     // var_dump($this->endpoint);
     // var_dump($this->verb);
     // var_dump($this->args);
     // var_dump($this->file);
     // var_dump($this->request);
     $db = new Db();
     if ($this->method == 'GET') {
         // /games/id
         if (count($this->args)) {
             return $this->_response($db->select($this->endpoint, $this->args[0]));
             // /games/search?name=value
         } elseif ($this->verb === "search") {
             return $this->_response($db->search($this->endpoint, $this->request));
             // /games/
         } else {
             return $this->_response($db->select($this->endpoint));
         }
         // /games/?name=value1&description=value2
     } elseif ($this->method == 'POST') {
         return $this->_response($db->insert($this->endpoint, $this->request));
     } elseif ($this->method == 'PUT') {
         return $this->_response("UPDATE method not found", 404);
     } elseif ($this->method == 'DELETE') {
         return $this->_response("DELETE method not found", 404);
     } else {
         return $this->_response("Request error ", 500);
     }
 }
开发者ID:kakauandme,项目名称:gamesApp,代码行数:34,代码来源:myapi.php

示例10: get_site_name

function get_site_name()
{
    global $db_config;
    $db = new Db($db_config);
    $settings = $db->row("SELECT * FROM `settings`");
    return $settings['site_name'];
}
开发者ID:rajuthapa8086,项目名称:cms,代码行数:7,代码来源:site_name.php

示例11: ChildPost

 public function ChildPost($post_id, $thread_id)
 {
     global $mySession;
     $db = new Db();
     $forumPostlist = $db->runQuery("select * from \n\t\t\t" . FORUM_POSTS . " inner join " . FORUM_THREADS . " on " . FORUM_POSTS . ".thread_id=" . FORUM_THREADS . ".thread_id \n\t\t\tinner join " . FORUM_TOPICS . " on " . FORUM_TOPICS . ".topic_id = " . FORUM_THREADS . ".topic_id  \n\t\t\t\tinner join " . USERS . " on " . USERS . ".user_id = " . FORUM_POSTS . ".user_id\n\t\t\t where topic_status='1' and " . FORUM_POSTS . ".replyof=" . $post_id . " and " . FORUM_THREADS . ".thread_id = " . $thread_id . " order by " . FORUM_POSTS . ".post_id desc");
     return $forumPostlist;
 }
开发者ID:ankuradhey,项目名称:dealtrip,代码行数:7,代码来源:Formposts.php

示例12: conectar

function conectar()
{
    $con = new Db("localhost", "root", "benjamin13");
    $con->connect();
    $con->select_db("conquistadores");
    return $con;
}
开发者ID:niko-afv,项目名称:KS-Project,代码行数:7,代码来源:funciones.php

示例13: init

 public function init()
 {
     global $mySession;
     $db = new Db();
     $myControllerName = Zend_Controller_Front::getInstance()->getRequest()->getControllerName();
     $myActionName = Zend_Controller_Front::getInstance()->getRequest()->getActionName();
     $defineData = $db->runQuery("select * from " . ADMINISTRATOR . " where admin_id='1'");
     define("ADMIN_EMAIL", array_key_exists('admin_email', $defineData[0]) ? $defineData[0]['admin_email'] : '');
     define("SITE_NAME", array_key_exists('site_title', $defineData[0]) ? $defineData[0]['site_title'] : 'TeeshirtSCRIPT');
     define("SITE_KEYWORD", array_key_exists('site_keyword', $defineData[0]) ? $defineData[0]['site_keyword'] : '');
     define("PRICE_SYMBOL", array_key_exists('currency_symbol', $defineData[0]) ? $defineData[0]['currency_symbol'] : '$');
     define("DEFAULT_BUSINESS_IMAGE", array_key_exists('default_business_image', $defineData[0]) ? $defineData[0]['default_business_image'] : 'my_default_business_image.png');
     define("DEFAULT_EVENT_IMAGE", array_key_exists('default_event_image', $defineData[0]) ? $defineData[0]['default_event_image'] : 'my_default_event_image.png');
     define("DEFAULT_MALE_USER_IMAGE", array_key_exists('default_male_image', $defineData[0]) ? $defineData[0]['default_male_image'] : 'my_default_male_image.png');
     define("DEFAULT_FEMALE_USER_IMAGE", array_key_exists('default_female_image', $defineData[0]) ? $defineData[0]['default_female_image'] : 'my_default_female_image.png');
     define("DEFAULT_USER_IMAGE", array_key_exists('default_both_image', $defineData[0]) ? $defineData[0]['default_both_image'] : 'my_default_both_image.png');
     if ($mySession->adminId == "" && $myControllerName != 'index') {
         $mySession->errorMsg = "Please login now to access administrator control panel.";
         $this->_redirect('index');
     }
     if ($mySession->adminId != "" && ($myControllerName == 'index' && $myActionName == 'index')) {
         $this->_redirect('dashboard');
     }
     $this->_helper->layout->setLayout('main');
 }
开发者ID:Alexeykolobov,项目名称:php,代码行数:25,代码来源:AppController.php

示例14: init

 public function init($categoryId)
 {
     global $mySession;
     $db = new Db();
     $CategoryName = "";
     $cattitle = "";
     $catdesc = "";
     $catimage = "";
     $rssurl = "";
     if ($categoryId != "") {
         //category_id, category_name, perent_id, cat_position, cat_title, cat_desc, cat_image, category_status, created_by, created_date
         $PageData = $db->runQuery("select * from " . CATEGORIES . " where category_id='" . $categoryId . "'");
         $CategoryName = $PageData[0]['category_name'];
         $catposition = $PageData[0]['cat_position'];
         $cattitle = $PageData[0]['cat_title'];
         $catdesc = $PageData[0]['cat_desc'];
         $catimage = $PageData[0]['cat_image'];
         $rssurl = $PageData[0]['rss_url'];
     }
     $cat_position = new Zend_Form_Element_Hidden('cat_position');
     $cat_position->setValue($catposition);
     $cat_image_file = new Zend_Form_Element_Hidden('cat_image_file');
     $cat_image_file->setValue($catimage);
     $cat_desc = new Zend_Form_Element_Textarea('cat_desc');
     $cat_desc->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Category Title is required.'))->setAttrib("style", "width:350px;height:150px")->setValue($catdesc);
     $category_name = new Zend_Form_Element_Text('category_name');
     $category_name->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Category Name is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "textInput")->setAttrib("style", "width:350px;")->setValue($CategoryName);
     $cat_title = new Zend_Form_Element_Text('cat_title');
     $cat_title->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Category Title is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "textInput")->setAttrib("style", "width:350px;")->setValue($cattitle);
     $rss_url = new Zend_Form_Element_Text('rss_url');
     $rss_url->setAttrib("class", "textInput")->setAttrib("style", "width:350px;")->setValue($rssurl);
     $photo_path = new Zend_Form_Element_File('photo_path');
     $photo_path->setDestination(SITE_ROOT . 'images/category/')->addValidator('Extension', false, 'jpg,jpeg,png,gif')->setRequired(false)->addDecorator('Errors', array('class' => 'error'));
     $this->addElements(array($category_name, $cat_title, $cat_desc, $cat_image_file, $rss_url, $cat_position, $photo_path));
 }
开发者ID:ankuradhey,项目名称:dealtrip,代码行数:35,代码来源:Category.php

示例15: myInit

 public function myInit()
 {
     global $mySession;
     $db = new Db();
     $public_name = "";
     $emailid_val = "";
     $bio_value = '';
     $old_profile_image_value = '';
     $qur = $db->runquery("SELECT * FROM  " . USERS . " WHERE user_id='" . $mySession->TeeLoggedID . "' ");
     if ($qur != "" and count($qur) > 0) {
         $public_name = $qur[0]['public_name'];
         $emailid_val = $qur[0]['emailid'];
         $bio_value = $qur[0]['bio'];
         $old_profile_image_value = $qur[0]['profile_image'];
     }
     $publicname = new Zend_Form_Element_Text('publicname');
     $publicname->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Public name is required'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib('class', 'changepasstextbox')->setValue($public_name);
     $bio = new Zend_Form_Element_Textarea('bio');
     $bio->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Bio is required.'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("class", "changepasstextarea")->setAttrib("style", "height:150px;width:354px;")->setAttrib("maxlength", "300")->setAttrib("placeholder", "Max 300 Characters")->setValue($bio_value);
     $profile_image = new Zend_Form_Element_File('profile_image');
     $profile_image->setDestination(SITE_ROOT . 'images/profileimages/')->addValidator('Extension', false, 'jpg,jpeg,png,gif')->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("class", "textInput")->setAttrib("style", "width:325px");
     $old_profile_image = new Zend_Form_Element_Hidden('old_profile_image');
     $old_profile_image->setValue($old_profile_image_value);
     $emailid = new Zend_Form_Element_Text('emailid');
     $emailid->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Email Id is required'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib('class', 'changepasstextbox')->setValue($emailid_val);
     $this->addElements(array($publicname, $emailid, $bio, $profile_image, $old_profile_image));
 }
开发者ID:Alexeykolobov,项目名称:php,代码行数:27,代码来源:Profile.php


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