當前位置: 首頁>>代碼示例>>PHP>>正文


PHP DBConnector::createConnection方法代碼示例

本文整理匯總了PHP中DBConnector::createConnection方法的典型用法代碼示例。如果您正苦於以下問題:PHP DBConnector::createConnection方法的具體用法?PHP DBConnector::createConnection怎麽用?PHP DBConnector::createConnection使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在DBConnector的用法示例。


在下文中一共展示了DBConnector::createConnection方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: deletePhoto

 public function deletePhoto($userId)
 {
     $connector = new DBConnector();
     $connection = $connector->createConnection();
     $query = 'DELETE FROM photo WHERE fk_id_user=' . $userId;
     mysql_query($query) or die("Error in query: {$query}. " . mysql_error());
     mysql_close($connection);
 }
開發者ID:laiello,項目名稱:qnet-ua2011,代碼行數:8,代碼來源:photoDAO.php

示例2: deleteQueryByID

 public function deleteQueryByID($queryID)
 {
     $connector = new DBConnector();
     $connection = $connector->createConnection();
     $query = "DELETE FROM queries WHERE id={$queryID}";
     mysql_query($query) or die("Error in query: {$query}. " . mysql_error());
     mysql_close($connection);
     return $queryID;
 }
開發者ID:laiello,項目名稱:qnet-ua2011,代碼行數:9,代碼來源:createQueryDAO.php

示例3: getStatisticTitleById

 public function getStatisticTitleById($sid)
 {
     $connector = new DBConnector();
     $connection = $connector->createConnection();
     $query = 'SELECT title FROM statistics WHERE id=' . $sid;
     $result = mysql_query($query) or die("Error in " . $query);
     $row = mysql_fetch_assoc($result);
     $title = $row['title'];
     mysql_free_result($result);
     mysql_close($connection);
     return $title;
 }
開發者ID:laiello,項目名稱:qnet-ua2011,代碼行數:12,代碼來源:statisticsDAO.php

示例4: loadAllComments

 public function loadAllComments($qId)
 {
     $connector = new DBConnector();
     $connection = $connector->createConnection();
     $result = mysql_query("SELECT * FROM comment WHERE FK_queryId='{$qId}'") or die("Error");
     //TODO DATE
     $ans = array();
     while ($row = mysql_fetch_assoc($result)) {
         $ans[$row['id']] = $row['text'];
     }
     mysql_free_result($result);
     mysql_close($connection);
     return $ans;
 }
開發者ID:laiello,項目名稱:qnet-ua2011,代碼行數:14,代碼來源:commentDAO.php

示例5: getMessage

 public function getMessage($mid)
 {
     $connector = new DBConnector();
     $connection = $connector->createConnection();
     $result = mysql_query("SELECT * FROM messages WHERE message_id = '{$mid}'");
     $message = mysql_fetch_array($result);
     $ans = array();
     $ans['title'] = $message['message_title'];
     $ans['from'] = $message['from_user'];
     $ans['content'] = $message['message_contents'];
     mysql_free_result($result);
     mysql_close($connection);
     return $ans;
 }
開發者ID:laiello,項目名稱:qnet-ua2011,代碼行數:14,代碼來源:messageDAO.php

示例6: modifyUserInfo

 /**
  *
  * @param <type> $id the user id to modify the values here
  * @param <type> $userInstanceNewValues  the new values of the user info
  *                                          that are in the user instance
  */
 public function modifyUserInfo($id, $userInstanceNewValues)
 {
     $connector = new DBConnector();
     $connection = $connector->createConnection();
     $userId = $userInstanceNewValues->getId();
     $gender = $userInstanceNewValues->gender;
     $maritalStatus = $userInstanceNewValues->maritalSt;
     $studies = $userInstanceNewValues->studies;
     $institutionName = $userInstanceNewValues->getInstitutionName();
     $country = $userInstanceNewValues->getCountry();
     $religion = $userInstanceNewValues->getReligion();
     $query = "UPDATE userinfo set gender='" . $gender . "', maritalSt='" . $maritalStatus . "', studies='" . $studies . "' , InstitutionName='" . $institutionName . "'  , currentLocation='" . $country . "' , religion='" . $religion . "'  where FK_users=" . $userId;
     mysql_query($query) or die("Error in query modifying user info : {$query}. " . mysql_error() . " and the user id is" . $id);
     mysql_close($connection);
 }
開發者ID:laiello,項目名稱:qnet-ua2011,代碼行數:21,代碼來源:UserInfoDao.php

示例7: selectAnswersByQueryId

 public function selectAnswersByQueryId($qid)
 {
     $connector = new DBConnector();
     $connection = $connector->createConnection();
     $ans = array();
     $query = 'SELECT id FROM qanswer where FK_queries = ' . $qid;
     $result = mysql_query($query) or die("Error in query: {$query}. " . mysql_error());
     $ix = 0;
     while ($answer = mysql_fetch_assoc($result)) {
         $ans[$ix++] = $answer['id'];
     }
     mysql_free_result($result);
     mysql_close($connection);
     return $ans;
 }
開發者ID:laiello,項目名稱:qnet-ua2011,代碼行數:15,代碼來源:answersDAO.php

示例8: DBConnector

<?php

require_once '../util.php';
require_db();
$connector = new DBConnector();
$connection = $connector->createConnection();
$name = "photo1";
$extension = "jpg";
$path = "path";
$userId = 1;
$size = 123;
$query = "INSERT INTO photo (name,extension,path,fk_id_user,size_kb) VALUE ('{$name}','{$extension}','{$path}','{$userId}', '{$size}');";
$result = mysql_query($query);
if (!$result) {
    return "error photo";
}
$userId = 12;
$query = 'DELETE FROM photo WHERE fk_id_user=' . $userId;
$result = mysql_query($query);
$rowsMysql = mysql_affected_rows();
if ($rowsMysql < 0) {
    return "error i cant delete more records";
}
if (!$result) {
    return "error photo";
}
mysql_close($connection);
class DBConnector
{
    function createConnection()
    {
開發者ID:laiello,項目名稱:qnet-ua2011,代碼行數:31,代碼來源:uploadPhoto.php

示例9: newTracking

 public function newTracking($follower, $followed)
 {
     $connector = new DBConnector();
     $connection = $connector->createConnection();
     $date = date('Y-m-d H:i:s');
     $query = "INSERT INTO trackings (followedId, followerId, approved, notified, date) VALUES ({$followed}, {$follower}, 0, 0, '{$date}')";
     mysql_query($query) or die("Error");
     $tid = mysql_insert_id();
     mysql_close($connection);
     return $tid;
 }
開發者ID:laiello,項目名稱:qnet-ua2011,代碼行數:11,代碼來源:trackingsDAO.php

示例10: initTransaction

 public function initTransaction()
 {
     $connector = new DBConnector();
     $this->connection = $connector->createConnection();
 }
開發者ID:laiello,項目名稱:qnet-ua2011,代碼行數:5,代碼來源:createStatisticsDAO.php


注:本文中的DBConnector::createConnection方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。