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