当前位置: 首页>>代码示例>>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;未经允许,请勿转载。