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


PHP DataAccess::executeQuery方法代碼示例

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


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

示例1: getCurrentDateTime

<?php

require_once 'DataAccess.php';
require_once 'includes/functions.php';
$name = $_POST['name'];
//user info
$id = 1;
$userName = "me";
$email = "email@email.com";
$description = $_POST['description'];
$stars = $_POST['stars'];
$latitude = $_POST['latitude'];
$longitude = $_POST['longitude'];
$now = getCurrentDateTime();
$sql = "INSERT INTO problems VALUES (null,'{$name}', '{$id}', '{$userName}', '{$email}','{$description}',null, 'fn','{$now}', 0, '{$now}', 'Active','{$stars}','{$latitude}','{$longitude}')";
$data = new DataAccess('photo');
$result = $data->executeQuery($sql);
$pid = mysql_insert_id();
if (!$result) {
    echo mysql_error();
    return;
}
$data->dispose();
return $pid;
開發者ID:nurzico,項目名稱:SanitationHackathonBangladesh,代碼行數:24,代碼來源:saveProblem.php

示例2: unlikeItem

function unlikeItem($userID, $itemID)
{
    $data = new DataAccess('photo');
    $sql = "SELECT like_count FROM items WHERE item_id={$itemID}";
    $resultset = $data->getResultSet($sql);
    $row = $data->getRow($resultset);
    $newitemtotal = $row['like_count'] - 1;
    $sql = "SELECT like_count FROM users WHERE fbid='{$userID}'";
    $resultset = $data->getResultSet($sql);
    $row = $data->getRow($resultset);
    $newusertotal = $row['like_count'] - 1;
    $newtime = getCurrentDateTime();
    $sql = "UPDATE items SET like_count={$newitemtotal} WHERE item_id={$itemID}";
    $data->executeQuery($sql);
    $sql = "UPDATE users SET like_count={$newusertotal} WHERE fbid='{$userID}'";
    $data->executeQuery($sql);
    $sql = "DELETE FROM users_likes WHERE fbid='{$userID}' AND item_id={$itemID}";
    $data->executeQuery($sql);
    $data->dispose();
}
開發者ID:nurzico,項目名稱:SanitationHackathonBangladesh,代碼行數:20,代碼來源:functions.php


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