本文整理汇总了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;
示例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();
}