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


PHP dbConnection函数代码示例

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


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

示例1: setMiembro

	 public function setMiembro($nombre, $apellido, $direccion, $cedula, $email, $casa, $movil, $pin, $categoria, $desc){
	 	
	 	dbConnection(); //Funcion que conecta a la base de datos
	 	
	 	$this->nombre = $nombre;
	 	$this->apellido = $apellido;
	 	$this->cedula = $cedula;
	 	$this->email = $email;
	 	$this->direccion = $direccion;
	 	$this->telefonoCasa = $casa;
	 	$this->telefonoMobil = $movil;
	 	$this->pin = $pin;
	 	$this->categoriaMiembro = $categoria;
	 	$this->desc = $desc;
	 	
	 	$query = "INSERT INTO miembro (codigo, nombre, apellido, direccion, cedula, email, telefono_casa, telefono_mobil, pin, categoria, descripcion)";
	 	$query.= " VALUES (NULL,'$this->nombre','$this->apellido','$this->direccion','$this->cedula','$this->email','$this->telefonoCasa','$this->telefonoMobil','$this->pin','$this->categoriaMiembro','$this->desc')";
	 	
	 	if(mysql_query($query)){
	 		echo "<script type='text/javascript'>
	 				alert('Datos Guardados Correctamente');
	 				window.location.href= 'frmMiembro.php';
	 			 </script>";
	 	};
	 	
	 }
开发者ID:natiums8311,项目名称:biblioteca,代码行数:26,代码来源:biblioteca.class.php

示例2: deleteMovie

 static function deleteMovie($id)
 {
     $sql = 'DELETE FROM Movie WHERE mov_id=:id;';
     $sth = dbConnection()->prepare($sql);
     $sth->execute(array(':id' => $id));
     $fetch = $sth->fetch();
     return $fetch;
 }
开发者ID:polytechlyon-isi1web,项目名称:mymovies-brazierl,代码行数:8,代码来源:movies.php

示例3: insertUser

 static function insertUser($u)
 {
     if ($u->firstname != '' && $u->lastname != '' && $u->login != '' && $u->password != '') {
         $sql = 'INSERT INTO User(use_login,use_password,use_firstname,use_lastname) VALUES (:login,:password,:firstname,:lastname)';
         $sth = dbConnection()->prepare($sql);
         $sth->execute(array(':login' => $u->login, ':password' => $u->password, ':firstname' => $u->firstname, ':lastname' => $u->lastname));
         $fetch = $sth->fetch();
         return $fetch;
     } else {
         return false;
     }
 }
开发者ID:polytechlyon-isi1web,项目名称:mymovies-brazierl,代码行数:12,代码来源:users.php

示例4: checkuser

function checkuser($fuid)
{
    $conn = dbConnection();
    $sql = "select * from voting where fbID='{$fuid}'";
    $result = $conn->query($sql);
    if ($result->num_rows > 0) {
        session_start();
        session_unset();
        return true;
    }
    return false;
}
开发者ID:harshatjk,项目名称:SwadesVotingSystem,代码行数:12,代码来源:modules.php

示例5: dbResultFromQuery

function dbResultFromQuery($query)
{
    $connection = dbConnection();
    if (!$connection) {
        die("MySQL Connection failed : " . mysqli_connect_error());
    }
    $result = 0;
    if (!empty($query)) {
        $result = mysqli_query($connection, $query) or die("<p>" . mysqli_error($connection) . "</p>");
    }
    mysqli_close($connection);
    return $result;
}
开发者ID:Travelite,项目名称:Travelite,代码行数:13,代码来源:functions.php

示例6: getGame

 /**
  * Function that queries the database for a specific Game and 
  * then returns the result.
  * 
  * @param int $title
  * @return Game
  */
 public function getGame($title)
 {
     $db = dbConnection();
     //Establish database connection
     //Prepare &execute the select statement to query the database.
     $stmt = $db->prepare("select * from Game where gme_id = ?");
     $result = $stmt->execute($title);
     //Return the Game if the query is successful.
     if ($result === true) {
         $game = $stmt->fetch();
         return new Game($game['gme_id'], $game['gme_title'], $game['gme_developer'], $game['gme_console'], $game['gme_price'], $game['gme_rating'], $game['gme_comments']);
     } else {
         throw new Exception("Could not find the game!");
     }
 }
开发者ID:justinbtadlock,项目名称:lis4368_a2,代码行数:22,代码来源:GameMapper.php

示例7: insertHash

function insertHash($user, $pass)
{
    $pass = password_hash($pass, PASSWORD_DEFAULT);
    $db = dbConnection();
    try {
        $sql = 'INSERT INTO users(username, password) VALUES(:user, :pass)';
        $stmt = $db->prepare($sql);
        $stmt->bindValue(':user', $user, PDO::PARAM_STR);
        $stmt->bindValue(':pass', $pass, PDO::PARAM_STR);
        $stmt->execute();
        $stmt->closeCursor();
    } catch (PDOException $exc) {
        return FALSE;
    }
}
开发者ID:gvh574,项目名称:cs313-php,代码行数:15,代码来源:functions.php

示例8: queryMysqli

function queryMysqli($query, array $params)
{
    $conPDO = dbConnection();
    try {
        //prepare the query
        $result = $conPDO->prepare($query);
        //execute the query with the passed parameters
        $result->execute($params);
        //close the database connection
        $conPDO = null;
        return $result;
    } catch (PDOException $e) {
        trigger_error('Error: ' . $e->getMessage(), E_USER_ERROR);
    }
}
开发者ID:afmiguez,项目名称:test,代码行数:15,代码来源:functions.php

示例9: getAlldetails

function getAlldetails($id, $lat, $lng)
{
    //! Message Loggin
    comment_message_log('Start of Function : ' . __FUNCTION__);
    //! Data base connection
    $rConnection = dbConnection();
    /*!
     * Check if the database Connection is failed
     */
    if (!$rConnection) {
        //! Message Loggin
        comment_message_log('End of Function : ' . __FUNCTION__);
        return E00010;
    }
    //! Query
    $sQuery = "SELECT * FROM `servicesubcatrelation` a,`ownerservice` b,`servicebranch` c WHERE a.sub_category_id={$id} and a.service_id=b.service_id and b.service_id=c.service_id ";
    //! Executing the query
    $res = mysqli_query($rConnection, $sQuery);
    /*!
     * Check If the Query executed properly
     */
    if ($res) {
        $data = array();
        //! retrieve the result from the result set
        while ($aRow = mysqli_fetch_assoc($res)) {
            if (distance($lat, $aRow['branch_lat'], $lng, $aRow['branch_lng']) < 300) {
                $data[] = $aRow;
            }
        }
        //! Closing the connections
        dbConnectionClose($rConnection);
        //! Message Login
        comment_message_log('Query Executed Successfully.::: ' . $sQuery);
        comment_message_log('End of Function : ' . __FUNCTION__);
        return $data;
    } else {
        comment_message_log('Query Execution failed. ::: ' . $sQuery . ' ::: ' . @mysqli_error($rConnection));
        comment_message_log('End of Function : ' . __FUNCTION__);
        //! Closing the connections
        dbConnectionClose($rConnection);
        return E00100;
    }
}
开发者ID:saurabhgarg1996,项目名称:Admin_Panel,代码行数:43,代码来源:subcategorydetails.php

示例10: aGetAllTags

function aGetAllTags()
{
    //! Message Loggin
    comment_message_log('Start of Function : ' . __FUNCTION__);
    //! Data base connection
    $rConnection = dbConnection();
    /*!
     * Check if the database Connection is failed
     */
    if (!$rConnection) {
        //! Message Loggin
        comment_message_log('End of Function : ' . __FUNCTION__);
        return E00010;
    }
    //! Query
    $sQuery = "SELECT * FROM `interests` ORDER BY `id` DESC;";
    //! Executing the query
    $rResultSet = mysqli_query($rConnection, $sQuery);
    //! Closing the connections
    dbConnectionClose($rConnection);
    /*!
     *  Check If the Query executed properly
     */
    if ($rResultSet != '') {
        //! Message Login
        comment_message_log('Query Executed Successfully. ::: ' . $sQuery);
        $aData = array();
        //! retrieve the result from the result set
        while ($aRow = mysqli_fetch_assoc($rResultSet)) {
            $aData[] = $aRow;
        }
        comment_message_log('End of Function : ' . __FUNCTION__);
        return $aData;
    } else {
        //! Message Loggin
        comment_message_log('Query Execution failed. ::: ' . $sQuery . ' ::: ' . @mysqli_error($rConnection));
        comment_message_log('End of Function : ' . __FUNCTION__);
        return E00100;
    }
}
开发者ID:saurabhgarg1996,项目名称:Admin_Panel,代码行数:40,代码来源:intfunctions.php

示例11: aGetUserbyPass

function aGetUserbyPass($user, $pass)
{
    //! Message Loggin
    comment_message_log('Start of Function : ' . __FUNCTION__);
    //! Data base connection
    $rConnection = dbConnection();
    /*!
     * Check if the database Connection is failed
     */
    if (!$rConnection) {
        //! Message Loggin
        comment_message_log('End of Function : ' . __FUNCTION__);
        return E00010;
    }
    //! Query
    $sQuery = "SELECT * FROM `admin` where `email` = '{$user}' AND `password` = '{$pass}';";
    //! Executing the query
    $rResultSet = mysqli_query($rConnection, $sQuery);
    //! Closing the connections
    dbConnectionClose($rConnection);
    /*!
     *  Check If the Query executed properly
     */
    if ($rResultSet != '') {
        //! Message Login
        comment_message_log('Query Executed Successfully. ::: ' . $sQuery);
        $aData = array();
        //! retrieve the result from the result set
        while ($aRow = mysqli_fetch_assoc($rResultSet)) {
            $aData = $aRow;
        }
        comment_message_log('End of Function : ' . __FUNCTION__);
        return $aData;
    } else {
        //! Message Loggin
        comment_message_log('Query Execution failed. ::: ' . $sQuery . ' ::: ' . @mysqli_error($rConnection));
        comment_message_log('End of Function : ' . __FUNCTION__);
        return E00100;
    }
}
开发者ID:saurabhgarg1996,项目名称:Admin_Panel,代码行数:40,代码来源:admin.php

示例12: insertintoservicesused

function insertintoservicesused($user_id, $service_id, $single_id, $freeserivce_id, $created_at)
{
    //! Message Loggin
    comment_message_log('Start of Function : ' . __FUNCTION__);
    //! Data base connection
    $rConnection = dbConnection();
    /*!
     * Check if the database Connection is failed
     */
    if (!$rConnection) {
        //! Message Loggin
        comment_message_log('End of Function : ' . __FUNCTION__);
        return E00010;
    }
    //! Query
    $sQuery = "INSERT INTO `services_used` (`id`,`user_id`,`service_id`, `singleent_id`,`freeservice_id` `timeStamp`) VALUES (NULL, '{$user_id}','{$service_id}','{$single_id}','{$freeservice_id}' ,'{$created_at}');";
    //! Executing the query
    $res = mysqli_query($rConnection, $sQuery);
    /*!
     * Check If the Query executed properly
     */
    if ($res) {
        $user_id = mysqli_insert_id($rConnection);
        //! Closing the connections
        dbConnectionClose($rConnection);
        return $user_id;
        //! Message Login
        comment_message_log('Query Executed Successfully.::: owner_id = $owner_id ::: ' . $sQuery);
        comment_message_log('End of Function : ' . __FUNCTION__);
    } else {
        comment_message_log('Query Execution failed. ::: ' . $sQuery . ' ::: ' . @mysqli_error($rConnection));
        comment_message_log('End of Function : ' . __FUNCTION__);
        //! Closing the connections
        dbConnectionClose($rConnection);
        return E00100;
    }
}
开发者ID:saurabhgarg1996,项目名称:Admin_Panel,代码行数:37,代码来源:servicesusedfunction.php

示例13: insertintoownerapp

function insertintoownerapp($owner_name, $owner_email, $service_mobile_num, $password, $created_at, $isActive, $type)
{
    //! Message Loggin
    comment_message_log('Start of Function : ' . __FUNCTION__);
    //! Data base connection
    $rConnection = dbConnection();
    /*!
     * Check if the database Connection is failed
     */
    if (!$rConnection) {
        //! Message Loggin
        comment_message_log('End of Function : ' . __FUNCTION__);
        return E00010;
    }
    //! Query
    $sQuery = "INSERT INTO `ownerapp` (`owner_id`,`owner_name`, `owner_email`, `service_mobile_number`, `password`, `timeStamp`,`isActive`,`type`) VALUES (NULL, '{$owner_name}','{$owner_email}','{$service_mobile_num}','{$password}','{$created_at}','{$isActive}','{$type}');";
    //! Executing the query
    $res = mysqli_query($rConnection, $sQuery);
    /*!
     * Check If the Query executed properly
     */
    if ($res) {
        $owner_id = mysqli_insert_id($rConnection);
        //! Closing the connections
        dbConnectionClose($rConnection);
        //! Message Login
        comment_message_log('Query Executed Successfully.::: owner_id = $owner_id ::: ' . $sQuery);
        comment_message_log('End of Function : ' . __FUNCTION__);
        return $owner_id;
    } else {
        comment_message_log('Query Execution failed. ::: ' . $sQuery . ' ::: ' . @mysqli_error($rConnection));
        comment_message_log('End of Function : ' . __FUNCTION__);
        //! Closing the connections
        dbConnectionClose($rConnection);
        return E00100;
    }
}
开发者ID:saurabhgarg1996,项目名称:Admin_Panel,代码行数:37,代码来源:ownerappfunctions.php

示例14: insertintofreeservicedb

function insertintofreeservicedb($owner_id, $branch_id, $frees_name, $free_description, $counter, $created_at, $validity)
{
    //! Message Loggin
    comment_message_log('Start of Function : ' . __FUNCTION__);
    //! Data base connection
    $rConnection = dbConnection();
    /*!
     * Check if the database Connection is failed
     */
    if (!$rConnection) {
        //! Message Loggin
        comment_message_log('End of Function : ' . __FUNCTION__);
        return E00010;
    }
    //! Query
    $sQuery = "INSERT INTO `freeservicedb` (`id`,`owner_id`, `branch_id`,`free_name` ,`free_description`,`counter`,`timestamp`,`validity`) VALUES (NULL, '{$owner_id}', '{$branch_id}','{$free_name}','{$free_description}','{$counter}', '{$created_at}','{$validity}');";
    //! Executing the query
    $res = mysqli_query($rConnection, $sQuery);
    /*!
     * Check If the Query executed properly
     */
    if ($res) {
        $id = mysqli_insert_id($rConnection);
        //! Closing the connections
        dbConnectionClose($rConnection);
        return $id;
        //! Message Login
        comment_message_log('Query Executed Successfully.::: owner_id = $owner_id ::: ' . $sQuery);
        comment_message_log('End of Function : ' . __FUNCTION__);
    } else {
        comment_message_log('Query Execution failed. ::: ' . $sQuery . ' ::: ' . @mysqli_error($rConnection));
        comment_message_log('End of Function : ' . __FUNCTION__);
        //! Closing the connections
        dbConnectionClose($rConnection);
        return E00100;
    }
}
开发者ID:saurabhgarg1996,项目名称:Admin_Panel,代码行数:37,代码来源:freeservicedbfunctions.php

示例15: insertintosingleent

function insertintosingleent($owner_id, $category_id, $ent_name, $ent_details, $ent_website, $isActive, $listingType, $ProvidesFreeSrvc, $premiumStartDate, $premiumEndDate, $amount_paid, $created_at)
{
    //! Message Loggin
    comment_message_log('Start of Function : ' . __FUNCTION__);
    //! Data base connection
    $rConnection = dbConnection();
    /*!
     * Check if the database Connection is failed
     */
    if (!$rConnection) {
        //! Message Loggin
        comment_message_log('End of Function : ' . __FUNCTION__);
        return E00010;
    }
    //! Query
    $sQuery = "INSERT INTO `servicebranch` (`ent_id`,`owner_id`,`category_id`,`ent_name`,`ent_details`,`ent_website`,`isActive` ,`listingType` ,`ProvidesFreeSrvc` ,`premiumStartDate` ,`premiumEndDate`,`amt_paid`,`timeStamp`) VALUES (NULL, '{$owner_id}', '{$category_id}','{$ent_name} ','{$ent_details}','{$ent_website}','{$isActive}' ,'{$listingType}' ,'{$ProvidesFreeSrvc}' ,'{$premiumStartDate}' ,'{$premiumEndDate}','{$amount_paid} ','{$created_at}');";
    //! Executing the query
    $res = mysqli_query($rConnection, $sQuery);
    /*!
     * Check If the Query executed properly
     */
    if ($res) {
        $ent_id = mysqli_insert_id($rConnection);
        //! Closing the connections
        dbConnectionClose($rConnection);
        return $ent_id;
        //! Message Login
        comment_message_log('Query Executed Successfully.::: owner_id = $owner_id ::: ' . $sQuery);
        comment_message_log('End of Function : ' . __FUNCTION__);
    } else {
        comment_message_log('Query Execution failed. ::: ' . $sQuery . ' ::: ' . @mysqli_error($rConnection));
        comment_message_log('End of Function : ' . __FUNCTION__);
        //! Closing the connections
        dbConnectionClose($rConnection);
        return E00100;
    }
}
开发者ID:saurabhgarg1996,项目名称:Admin_Panel,代码行数:37,代码来源:singleentfunction.php


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