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


PHP openConnection函数代码示例

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


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

示例1: DoQuery

function DoQuery($t) {
	$str = "{\"result\":0, \"data\":[";
	$db = openConnection();
	$stmt = $db->prepare("select id, nickname, comment, photo1, photo2, photo3, photo4, photo5, commit_date from feedback where status = ? order by id desc");
	$stmt->bind_param("i", $t);
	$stmt->execute();
	$id = 0;
	$nickname = "";
	$comment = "";
	$photo1 = "";
	$photo2 = "";
	$photo3 = "";
	$photo4 = "";
	$photo5 = "";
	$commit_date = "";
	$stmt->bind_result($id, $nickname, $comment, $photo1, $photo2, $photo3, $photo4, $photo5, $commit_date);
	while ($stmt->fetch()) {
		$str .= "{\"id\":${id},\"nickname\":".json_encode($nickname).",\"comment\":".json_encode($comment).",\"photo1\":\"${photo1}\",\"photo2\":\"${photo2}\",\"photo3\":\"${photo3}\",\"photo4\":\"${photo4}\",\"photo5\":\"${photo5}\",\"commit_date\":\"${commit_date}\"},"; 
	}
	$stmt->close();
	closeConnection($db);
	$str = rtrim($str, ",");
	$str .= "]}";
	return $str;
}
开发者ID:rarnu,项目名称:root-tools,代码行数:25,代码来源:query_feedback.php

示例2: EditUser

function EditUser($userDetails)
{
    if (!CorrectUserInputs($userDetails)) {
        return false;
    }
    try {
        // $aboutme = htmlspecialchars($userDetails['aboutme']);
        $conn = openConnection();
        $stmt = $conn->prepare("UPDATE user SET firstname=:firstname, lastname=:lastname, gender=:gender, salutation=:salutation, birthdate=:birthdate, password=:password, aboutme=:aboutme, accesslevel=:accesslevel WHERE username=:username");
        $stmt->bindParam(':firstname', $userDetails['firstname']);
        $stmt->bindParam(':lastname', $userDetails['lastname']);
        $stmt->bindParam(':gender', $userDetails['gender']);
        $stmt->bindParam(':salutation', $userDetails['salutation']);
        $stmt->bindParam(':birthdate', $userDetails['birthdate']);
        $stmt->bindParam(':username', $userDetails['username']);
        $stmt->bindParam(':password', $userDetails['password']);
        $stmt->bindParam(':aboutme', $userDetails['aboutme']);
        $stmt->bindParam(':accesslevel', $userDetails['accesslevel']);
        $stmt->execute();
    } catch (PDOException $e) {
        return false;
    }
    $conn = null;
    return true;
}
开发者ID:kayecandy,项目名称:secudev,代码行数:25,代码来源:user.php

示例3: DoUpload

function DoUpload($n, $p, $u, $i, $a, $m, $ai)
{
    $ret = "";
    $str = "";
    if ($m == 1) {
        // update
        $db = openConnection();
        $sql = "update root_tools_recommand set name='{$n}',icon_url='{$i}',download_url='{$a}' where package_name='{$p}'";
        $str = query($db, $sql);
        closeConnection($db);
    } else {
        // add
        $id = generateId("root_tools_recommand", "id");
        $db = openConnection();
        $sql = "insert into root_tools_recommand (id, name, package_name, main_activity, icon_url, download_url, unix_name, app_order) values ({$id}, '{$n}', '{$p}', 'null', '{$i}', '{$a}', '{$u}', 0)";
        $str = query($db, $sql);
        closeConnection($db);
    }
    if ($str == "0") {
        $ret = "1";
    } else {
        $ret = "0";
    }
    return $ret;
}
开发者ID:lasting-yang,项目名称:root-tools,代码行数:25,代码来源:upload.php

示例4: DoQuery

function DoQuery($t) {
	$db = openConnection();
	$id = 0;
	$versionCode = 0;
	$versionName = "";
	$url = "";
	$desc = "";
	$desc_en = "";
	$ret = "{\"versionCode\":0}";
	if ($t == "last" || empty($t)) {
		$stmt = $db->prepare("select * from version order by versionCode desc limit 0, 1");
		$stmt->execute();
		$stmt->bind_result($id, $versionCode, $versionName, $url, $desc, $desc_en);
		$stmt->fetch();
		$ret = "{\"versionCode\":${versionCode}, \"versionName\":".json_encode($versionName).", \"url\":".json_encode($url).", \"description\":".json_encode($desc).",\"desc_en\":".json_encode($desc_en)."}";
		$stmt->close();
	} else if ($t == "all") {
		$ret = "{\"result\":0, \"data\":[";
		$stmt = $db->prepare("select * from version order by versionCode desc limit 0, 10");
		$stmt->execute();
		$stmt->bind_result($id, $versionCode, $versionName, $url, $desc, $desc_en);
		while($stmt->fetch()) {
			$ret .= "{\"versionCode\":${versionCode}, \"versionName\":".json_encode($versionName).", \"url\":".json_encode($url).", \"description\":".json_encode($desc).",\"desc_en\":".json_encode($desc_en)."},";
		}
		$ret = rtrim($ret, ",");
		$ret .= "]}";
	}
	closeConnection($db);
	return $ret;
}
开发者ID:rarnu,项目名称:root-tools,代码行数:30,代码来源:version.php

示例5: doCheckUpdate

function doCheckUpdate($v, $d)
{
    $db = openConnection();
    $sql = "";
    $user_id = "";
    $str = "{\"result\":\"0\",\"version_code\":\"0\",\"version_name\":\"\",\"file\":\"\",\"size\":\"\",\"desc\":\"\"}";
    if (!empty($d)) {
        $sql = "select id from root_tools_update_user where device='{$d}'";
        $result = query($db, $sql);
        while (list($id) = mysql_fetch_row($result)) {
            $user_id = $id;
            break;
        }
        if ($user_id != "") {
            $sql = "select * from root_tools_update where ver_code > {$v} order by id desc limit 0,1";
            $result = query($db, $sql);
        }
    } else {
        $sql = "select * from root_tools_update where tag=0 and ver_code > {$v} order by id desc limit 0,1";
        $result = query($db, $sql);
    }
    closeConnection($db);
    while (list($id, $name, $ver_code, $size, $filename, $update_desc) = mysql_fetch_row($result)) {
        $str = "{\"result\":\"1\",\"version_code\":\"{$ver_code}\",\"version_name\":\"{$name}\",\"file\":\"{$filename}\",\"size\":\"{$size}\",\"desc\":" . json_encode($update_desc) . "}";
        break;
    }
    return $str;
}
开发者ID:lasting-yang,项目名称:root-tools,代码行数:28,代码来源:check_update.php

示例6: getAllScheduleTimeslotsBetween

function getAllScheduleTimeslotsBetween($startTime, $endTime)
{
    $timeslots = array();
    $result = openConnection("Call get_all_schedule_timeslots();");
    //var_dump($result);
    //$result = openConnection("get_all_schedule_timeslots_between(".$startTime.", ".$endTime.");");
    $timeslots;
    if ($result->num_rows > 0) {
        mysqli_data_seek($result, 0);
        while ($row = $result->fetch_assoc()) {
            $startTime = $row['startTime'];
            $endTime = $row['endTime'];
            $timeslotId = $row['timeslotId'];
            $firefighterId = $row['firefighterId'];
            $firstName = $row['firstName'];
            $lastName = $row['lastName'];
            $email = $row['email'];
            $phone = $row['phone'];
            $secondaryPhone = $row['secondaryPhone'];
            $carrier = $row['phoneProvider'];
            $scheduleTimeslotId = $row['scheduleTimeslotId'];
            $firefighter = new Firefighter($firefighterId, $firstName, $lastName, $email, $phone, $secondaryPhone, $carrier);
            $timeslot = new TimeSlot($timeslotId, $startTime, $endTime, $firefighter);
            $scheduleTimeslot = new ScheduleTimeslot($timeslot, $scheduleTimeslotId);
            array_push($timeslots, $scheduleTimeslot);
        }
    }
    return $timeslots;
}
开发者ID:Goldenpearl,项目名称:CS495_FireDept,代码行数:29,代码来源:scheduleGrab.php

示例7: DoQuery

function DoQuery($n, $c, $p1, $p2, $p3, $p4, $p5) {
	$str = "{\"result\":1}";
	date_default_timezone_set("Asia/Hong_Kong");
	$t_str = date("YmdHis");
	$commit_date = date("Y-m-d H:i:s");
	$pname = generateToken().".${t_str}.";
	$path1 = "./files/${pname}1";
	$path2 = "./files/${pname}2";
	$path3 = "./files/${pname}3";
	$path4 = "./files/${pname}4";
	$path5 = "./files/${pname}5";
	$dbp1 = "";
	$dbp2 = "";
	$dbp3 = "";
	$dbp4 = "";
	$dbp5 = "";
	if (isset($p1)) { move_uploaded_file($p1["tmp_name"], $path1); $dbp1 = "${pname}1"; }
	if (isset($p2)) { move_uploaded_file($p2["tmp_name"], $path2); $dbp2 = "${pname}2"; }
	if (isset($p3)) { move_uploaded_file($p3["tmp_name"], $path3); $dbp3 = "${pname}3"; }
	if (isset($p4)) { move_uploaded_file($p4["tmp_name"], $path4); $dbp4 = "${pname}4"; }
	if (isset($p5)) { move_uploaded_file($p5["tmp_name"], $path5); $dbp5 = "${pname}5"; }
	$db = openConnection();
	$stmt = $db->prepare("insert into feedback(nickname, comment, photo1, photo2, photo3, photo4, photo5, commit_date) values (?, ?, ?, ?, ?, ?, ?, ?)");
	$stmt->bind_param("ssssssss", $n, $c, $dbp1, $dbp2, $dbp3, $dbp4, $dbp5, $commit_date);
	$stmt->execute();
	$rows = intval($stmt->affected_rows);
	$stmt->close();
	closeConnection($db);
	if ($rows != 0) {
		$str = "{\"result\":0}";
	}
	return $str;	
}
开发者ID:rarnu,项目名称:root-tools,代码行数:33,代码来源:feedback.php

示例8: doUploadFont

function doUploadFont($n, $t)
{
    $dbRet = 0;
    $sql = "select id from fonts where name='{$n}'";
    $db = openConnection();
    $result = query($db, $sql);
    $hasRecord = 0;
    while (list($id) = mysql_fetch_row($result)) {
        $hasRecord = 1;
        break;
    }
    if ($hasRecord == 0) {
        $istop = 0;
        if ($t == "1") {
            $istop = 1;
        }
        $fileName = $n . ".ttf";
        $previewName = $n . ".png";
        $sql = "insert into fonts (name, filename, istop, preview) values ('{$n}','{$fileName}',{$istop},'{$previewName}')";
        $result = query($db, $sql);
        $dbRet = $result;
    }
    closeConnection($db);
    return $dbRet;
}
开发者ID:lasting-yang,项目名称:root-tools,代码行数:25,代码来源:upload_font.php

示例9: doUploadNewVersion

function doUploadNewVersion($n, $v, $s, $f, $u, $t)
{
    $db = openConnection();
    $sql = "insert into root_tools_update (name, ver_code, size, filename, update_desc,tag) values ('{$n}',{$v},'{$s}','{$f}','{$u}',{$t})";
    $result = query($db, $sql);
    closeConnection($db);
    return $result;
}
开发者ID:lasting-yang,项目名称:root-tools,代码行数:8,代码来源:upload_new_version.php

示例10: doAddDevice

function doAddDevice($d, $u)
{
    $db = openConnection();
    $sql = "insert into root_tools_update_user (device, user_memo) values ('{$d}', '{$u}')";
    $result = query($db, $sql);
    closeConnection($db);
    return $result;
}
开发者ID:lasting-yang,项目名称:root-tools,代码行数:8,代码来源:add_device.php

示例11: doRecordFeedback

function doRecordFeedback($i, $e, $t, $a, $o)
{
    $db = openConnection();
    $sql = "insert into yugioh_feedback (device, email, feedback, appver, osver) values ('{$i}','{$e}','{$t}','{$a}','{$o}')";
    $result = query($db, $sql);
    closeConnection($db);
    return $result;
}
开发者ID:lasting-yang,项目名称:root-tools,代码行数:8,代码来源:feedback.php

示例12: doDeleteDevice

function doDeleteDevice($i)
{
    $db = openConnection();
    $sql = "delete from root_tools_update_user where id={$i}";
    $result = query($db, $sql);
    closeConnection($db);
    return $result;
}
开发者ID:lasting-yang,项目名称:root-tools,代码行数:8,代码来源:delete_device.php

示例13: DoChangeOrder

function DoChangeOrder($i, $a)
{
    $sql = "update root_tools_recommand set app_order={$a} where id={$i}";
    $db = openConnection();
    $result = query($db, $sql);
    closeConnection($db);
    return $result;
}
开发者ID:lasting-yang,项目名称:root-tools,代码行数:8,代码来源:change_order.php

示例14: doDeleteRecommand

function doDeleteRecommand($i)
{
    $sql = "delete from yugioh_recommand where id={$i}";
    $db = openConnection();
    $result = query($db, $sql);
    closeConnection($db);
    return $result;
}
开发者ID:lasting-yang,项目名称:root-tools,代码行数:8,代码来源:delete_recommand.php

示例15: DoDeletePackage

function DoDeletePackage($i)
{
    $sql = "delete from root_tools_recommand where id={$i}";
    $db = openConnection();
    $result = query($db, $sql);
    closeConnection($db);
    return $result;
}
开发者ID:lasting-yang,项目名称:root-tools,代码行数:8,代码来源:delete_package.php


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