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


PHP connectDB函数代码示例

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


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

示例1: notificacionesIniciales

function notificacionesIniciales()
{
    $conexion = connectDB();
    $seccion = $_POST['seccion'];
    $prioridad = $_POST['prioridad'];
    $estado = $_POST['estado'];
    $tipo = $_POST['tipo'];
    $query = "call spCargaNotificacionesDir('" . $seccion . "','" . $prioridad . "','" . $estado . "','" . $tipo . "')";
    echo '<div id="contAll">';
    $hacer_consulta = mysqli_query($conexion, $query);
    while ($result = mysqli_fetch_array($hacer_consulta, MYSQLI_ASSOC)) {
        $id = utf8_encode($result['pinSubrogacion']);
        echo '<div class="rowTable"><center>' . utf8_encode($result['servicioSubrogar']) . ' | ' . utf8_encode($result['estudioSubrogar']) . ' | ' . utf8_encode($result['nombre']) . ' ' . utf8_encode($result['apellidoPaterno']) . ' | ' . utf8_encode($result['estado']) . ' | ' . utf8_encode($result['seccion']) . ' | ' . utf8_encode($result['tipoServicio']) . '
	        	</center><div id="Tit"></div>
	        	<div class="rowButtons">
	         		<input type="button" class="btnsNotif" id="' . $id . '" onclick="revisarSolicitud(this.id,0)" value="Ver" onclick=""></input> 
	         		<input type="button" class="btnsNotif" id="' . $id . '" onclick="revisarSolicitud(this.id,1)" value="Aprobar"></input> 
	         		<input type="button" class="btnsNotif" id="' . $id . '" onclick="revisarSolicitud(this.id,2)" value="Denegar"></input> 
	         	</div>
	        </div>
	        <br>
        ';
    }
    echo '</div>';
}
开发者ID:OroCanfer,项目名称:seguro,代码行数:25,代码来源:notificaciones.php

示例2: cleanUp

function cleanUp()
{
    if ($_SESSION['cMethod'] == 'new' || $_SESSION['dbCreateMethod'] == 'new') {
        if (!connectDB()) {
            return false;
        }
        if (isset($_SESSION['dbInfo']['dbOHRMUserName'])) {
            $query = dropUser();
        }
        $query[0] = dropDB();
        $sucExec = $query;
        $overall = true;
        for ($i = 0; $i < count($query); $i++) {
            $sucExec[$i] = mysql_query($query[$i]);
            if (!$sucExec[$i]) {
                $overall = false;
            }
        }
        if (!$overall) {
            connectDB();
            for ($i = 0; $i < count($query); $i++) {
                if (!$sucExec[$i]) {
                    $sucExec[$i] = mysql_query($query[$i]);
                }
                if (!$sucExec[$i]) {
                    $overall = false;
                }
            }
        }
    }
    $sucExec[] = delConf();
    return $sucExec;
}
开发者ID:abdocmd,项目名称:orangehrm-3.0.1,代码行数:33,代码来源:cleanUp.php

示例3: loginOverride

function loginOverride($coreUserInfo)
{
    global $gasDatabaseName;
    if ($coreUserInfo["ErrorCode"] == 0) {
        $tableName = "Employee";
        $uid = $coreUserInfo["Result"]["Uid"];
        connectDB($gasDatabaseName);
        $sql = "select * from {$tableName} where Uid = '{$uid}'";
        $data = getData($sql);
        // 该用户是否已经注册
        if (empty($data)) {
            printResultByMessage("用戶未註冊", 1001);
        }
        $data = $data[0];
        // 该gasman是否通过瓦斯行的审核
        if ($data["Verify"] === "0") {
            printResultByMessage("請通知瓦斯行進行審核", 1002);
        }
        $info = array();
        foreach ($data as $key => $value) {
            $info["{$key}"] = $value;
        }
        foreach ($coreUserInfo["Result"] as $key => $value) {
            $info["{$key}"] = $value;
        }
        $_SESSION["Info"] = $info;
        echo json_encode($coreUserInfo);
        die;
    }
}
开发者ID:qichangjun,项目名称:HTMLLearn,代码行数:30,代码来源:function.php

示例4: extractBase

function extractBase($build, $runid, $catFilterID = '0', $compFilterID = '0')
{
    $link = connectDB();
    $sql = "SELECT caseResults.caseID as caseid, versions.versionFull as build,caseStatus.caseStatus as status, caseResults.caseExecutionTime as time , " . "scriptResults.scriptCommandLine as runtype, runs.runner as user , cases.caseName as caseName, cases.categoryID as category, cases.componentID as component " . "FROM cases, caseResults, caseStatus, scriptResults, runs, versions " . "WHERE versions.versionID = runs.versionID and runs.runID = scriptResults.runID and caseResults.caseStatusID = caseStatus.caseStatusID " . "and cases.scriptID = scriptResults.scriptID and caseResults.scriptResultID = scriptResults.scriptResultID " . "and caseResults.caseID = cases.caseID and versions.buildNum = " . $build . " and runs.runID  = " . $runid;
    $sql .= $catFilterID ? $compFilterID ? ' and cases.categoryID = ' . $catFilterID . ' and cases.componentID = ' . $compFilterID . ';' : ' and cases.categoryID = ' . $catFilterID . ';' : ';';
    //$sql .= ($compFilterID)?' and cases.componentID = ' .$compFilterID .';': ';';
    $result = mysql_query($sql, $link);
    $number = mysql_num_rows($result);
    if ($number > 0) {
        while ($cases = mysql_fetch_assoc($result)) {
            $runtype = runTypeBaseline($cases['user'], $cases['runtype']);
            $casename = caseNameIssue($cases['caseName']);
            if ($runtype == "Nothing" or $casename) {
                continue;
            }
            //means userid is nightly but runtype is not Smoke.
            if ($runtype == "NoSmokeReg") {
                mysql_close($link);
                return 0;
            }
            $time = sec2Basetime($cases["time"]);
            $baseline = $cases['status'] . "(" . $time . ")(" . $cases['build'] . ")(" . $runtype . ")";
            updateBaseline($baseline, $cases['caseid'], $cases['category'], $cases['component'], $runtype);
        }
        baselineStatus($baseline);
        mysql_close($link);
        return 1;
    } else {
        return 0;
    }
}
开发者ID:window98lsq,项目名称:autoweb,代码行数:31,代码来源:baseline_lib.php

示例5: checkout

function checkout($id)
{
    $now = date('Y-m-d H:i:s');
    $now_day = date('d', strtotime($now));
    $now_month = date('m', strtotime($now));
    $now_year = date('Y', strtotime($now));
    $connect = connectDB();
    $db = mysql_select_db('contacttime', $connect);
    if (!$db) {
        die('データベース選択失敗です。' . mysql_error());
    }
    //前に開始していない場合にエラーを出す
    $result = mysql_query("select * from time where id = " . $id . " and end is not NULL");
    $row = mysql_fetch_assoc($result);
    if (!empty($row)) {
        echo '<div class="alert alert-block">すでに終了しています</div>';
    } else {
        //その日の23:59:59秒までしか有効ではない
        $result = mysql_query("select * from time where id = " . $id);
        $row = mysql_fetch_assoc($result);
        $start = date('d', strtotime($row["start"]));
        $start_month = date('m', strtotime($row["start"]));
        $start_year = date('Y', strtotime($row["start"]));
        if ($now_day > $start || $now_month > $start_month || $now_year > $start_year) {
            $now = $start_year . '-' . $start_month . '-' . $start . ' 23:59:59';
            var_dump($now);
        }
        $result = mysql_query("update time set end = '" . $now . "' where id = " . $id);
        if (!$result) {
            die('クエリーが失敗しました。' . mysql_error());
        }
    }
    mysql_close($connect);
}
开发者ID:hanaken,项目名称:contact_time,代码行数:34,代码来源:logic.php

示例6: reconnectDB

function reconnectDB()
{
    global $db;
    if (!$db->ping()) {
        connectDB(false);
    }
}
开发者ID:dg-wfk,项目名称:dl,代码行数:7,代码来源:dbfuncs.php

示例7: executeDB

function executeDB($sql)
{
    connectDB();
    mysql_query("SET NAMES UTF8") or die('query failed:' . mysql_error());
    mysql_query($sql);
    return mysql_affected_rows();
}
开发者ID:samuelcs,项目名称:videonewsweb,代码行数:7,代码来源:db.php

示例8: checkHowManyImages

function checkHowManyImages()
{
    $con = connectDB();
    $aantalImage = $con->query("SELECT COUNT(image) FROM image");
    $row = $aantalImage->fetch_row();
    return $row[0];
}
开发者ID:ThimoJonker,项目名称:github-school,代码行数:7,代码来源:scripttest.php

示例9: run

    function run()
    {
        $go = new ShortURL();
   
		if( isset( $this->request['action'] ) )
		{
			if( $this->request['action'] == 'add' )
			{	
				$go->print_results();
			}
			elseif( $this->request['action'] == 'req' )
			{
				$go->print_request_form();
			}
			elseif( $this->request['action'] == 'email' )
			{
				$go->send_email();
			}
		}
		else
		{
			$go->print_form();
		}
        
        //Since we connected to a different DB inside ShortURL, we need to 
        //reconnect to Reason after we are done. 
        connectDB( REASON_DB );
    }
开发者ID:natepixel,项目名称:reason_package,代码行数:28,代码来源:go.php

示例10: getArraySQL

function getArraySQL($sql)
{
    //Creamos la conexión con la función anterior
    $conexion = connectDB();
    //generamos la consulta
    mysqli_set_charset($conexion, "utf8");
    //formato de datos utf8
    $result = mysqli_query($conexion, $sql);
    if (!$sql) {
        echo "La consulta no se logró: " . mysql_error();
        die;
        //si la conexión cancelar programa
    }
    //creamos un array
    $rawdata = array();
    //guardamos en un array multidimensional todos los datos de la consulta
    $i = 0;
    while ($row = mysqli_fetch_array($result)) {
        $rawdata[$i] = $row;
        $i++;
    }
    header("Content-type: application/json");
    header("Access-Control-Allow-Origin: *");
    disconnectDB($conexion);
    //desconectamos la base de datos
    return $rawdata;
    //devolvemos el array
}
开发者ID:KevMCh,项目名称:OurGallery-PhoneGap,代码行数:28,代码来源:connection.php

示例11: getArraySQL

 function getArraySQL($sql, $DB)
 {
     //Creamos la conexión con la función anterior
     $conexion = connectDB();
     mysqli_select_db($conexion, $DB);
     //selecciono la base de datos
     //generamos la consulta
     mysqli_set_charset($conexion, "utf8");
     //formato de datos utf8
     if (!($result = mysqli_query($conexion, $sql))) {
         die;
     }
     //si la conexión cancelar programa
     $rawdata = array();
     //creamos un array
     //guardamos en un array multidimensional todos los datos de la consulta
     $i = 0;
     while ($row = mysqli_fetch_array($result)) {
         $rawdata[$i] = $row;
         $i++;
     }
     disconnectDB($conexion);
     //desconectamos la base de datos
     return $rawdata;
     //devolvemos el array
 }
开发者ID:andresmauro17,项目名称:first_repository,代码行数:26,代码来源:conexion.php

示例12: get_pronoun_id

function get_pronoun_id($subjP, $objP, $possDetP, $possP, $reflexP)
{
    $pronoun_hash = hashPronouns($subjP, $objP, $possDetP, $possP, $reflexP);
    $db = connectDB();
    try {
        $stmt = $db->prepare("SELECT pronoun_id FROM cr_pronouns WHERE pronoun_hash=:pronoun_hash;");
        $stmt->bindValue(':pronoun_hash', $pronoun_hash, PDO::PARAM_STR);
        $stmt->execute();
        $rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
        if (sizeOf($rows) != 0) {
            $pronounID = $rows[0]['pronoun_id'];
        } else {
            $stmt = $db->prepare("INSERT INTO cr_pronouns(pronoun_id, pronoun_hash, subj, obj, poss_det, poss_pro,\n                                  reflexive) VALUES('', :pronoun_hash, :subj, :obj, :poss_det, :poss_pro,\n                                  :reflexive);");
            $stmt->bindValue(':pronoun_hash', $pronoun_hash, PDO::PARAM_STR);
            $stmt->bindValue(':subj', $subjP, PDO::PARAM_STR);
            $stmt->bindValue(':obj', $objP, PDO::PARAM_STR);
            $stmt->bindValue(':poss_det', $possDetP, PDO::PARAM_STR);
            $stmt->bindValue(':poss_pro', $possP, PDO::PARAM_STR);
            $stmt->bindValue(':reflexive', $reflexP, PDO::PARAM_STR);
            $stmt->execute();
            $stmt = $db->prepare("SELECT pronoun_id FROM cr_pronouns WHERE pronoun_hash=:pronoun_hash;");
            $stmt->bindValue(':pronoun_hash', $pronoun_hash, PDO::PARAM_STR);
            $stmt->execute();
            $rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
            $pronounID = $rows[0]['pronoun_id'];
        }
    } catch (PDOException $ex) {
        header("Location: ./register?err=pronoun");
    }
    return $pronounID;
}
开发者ID:rennep1026,项目名称:collectr,代码行数:31,代码来源:userRegister.php

示例13: login

function login($username, $mdp)
{
    session_start();
    $link = connectDB();
    // Requête qui va chercher dans la BDD la ligne qui correspond
    // à la combinaison utilisateur/mot de passe
    $query = 'SELECT id_Utilisateur
                  FROM Utilisateur
                  WHERE nom_Utilisateur = "' . mysqli_real_escape_string($link, $username) . '" AND
                        MDP_Utilisateur = "' . mysqli_real_escape_string($link, HashPassword($mdp)) . '"';
    $row = queryDB($query);
    // Si une seule combinaison utilisateur/mdp ressort de la requête,
    // on le connecte
    if (count($row) == 1) {
        // Requête pour inserer l'id de l'utilisateur dans la table de connexion
        $query = "INSERT INTO Connexion(User_Connexion)\n                      VALUES (" . $row['id_Utilisateur'] . ")";
        queryDB($query);
        // On met en variables de session
        // Que l'utilisateur est connecté
        $_SESSION['isloged'] = true;
        // Son pseudo
        $_SESSION['user'] = $username;
        // Son id
        $_SESSION['id_user'] = $row['id_Utilisateur'];
        return true;
    } else {
        // Login Not Ok
        $_SESSION['isloged'] = false;
        return false;
    }
}
开发者ID:Helladan,项目名称:Projet-S1,代码行数:31,代码来源:function-login.php

示例14: getTitle

function getTitle($type, $id)
{
    $mysqli = connectDB();
    $result = $mysqli->query("SELECT title FROM " . $type . "s WHERE " . $type . "_id = '" . $id . "'");
    $row = $result->fetch_object();
    return $row->title;
}
开发者ID:atheby,项目名称:Blogs,代码行数:7,代码来源:functions.php

示例15: emailExists

function emailExists($email)
{
    $pdo = connectDB();
    $stmt = $pdo->prepare('SELECT EXISTS(SELECT 1 FROM Users WHERE Email LIKE :email)');
    $stmt->execute(array(':email' => $email));
    $fetch = $stmt->fetch();
    return (int) $fetch[0];
}
开发者ID:MeYururi,项目名称:gs,代码行数:8,代码来源:phpfunc.php


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