本文整理汇总了PHP中getQuery函数的典型用法代码示例。如果您正苦于以下问题:PHP getQuery函数的具体用法?PHP getQuery怎么用?PHP getQuery使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getQuery函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: users
public function users($app, $page)
{
$page = array_merge($page, array('title' => __('Users'), 'q' => $app->request()->params('q', '')));
$sort = $app->request()->params('sort', '');
$user = DatawrapperSession::getUser();
function getQuery($user)
{
global $app;
$sort = $app->request()->params('sort', '');
$query = UserQuery::create()->leftJoin('User.Chart')->withColumn('COUNT(Chart.Id)', 'NbCharts')->groupBy('User.Id')->filterByDeleted(false);
$q = $app->request()->params('q');
if ($q) {
$query->where('email LIKE "%' . $q . '%" OR name LIKE "%' . $q . '%"');
}
if (!$user->isSysAdmin()) {
$query->filterByRole('sysadmin', Criteria::NOT_EQUAL);
}
switch ($sort) {
case 'name':
$query->orderByName('asc');
break;
case 'email':
$query->orderByEmail('asc');
break;
case 'charts':
$query->orderBy('NbCharts', 'desc');
break;
case 'created_at':
default:
$query->orderBy('createdAt', 'desc');
break;
}
return $query;
}
$curPage = $app->request()->params('page', 0);
$total = getQuery($user)->count();
$perPage = 50;
$append = '';
if ($page['q']) {
$append = '&q=' . $page['q'];
}
if (!empty($sort)) {
$append .= '&sort=' . $sort;
}
add_pagination_vars($page, $total, $curPage, $perPage, $append);
$page['users'] = getQuery($user)->limit($perPage)->offset($curPage * $perPage)->find();
$app->render('plugins/admin-users/admin-users.twig', $page);
}
示例2: fileSearch
function fileSearch()
{
$wheres = array();
//input
if ($_POST['filename'] != "") {
$filenameValue = $_POST['filename'];
$filenameQuery = "name LIKE '%" . $filenameValue . "%'";
array_push($wheres, $filenameQuery);
}
if ($_POST['startDate'] != "") {
$startDateValue = strtotime($_POST['startDate']);
$startDateQuery = "timestamp > '" . $startDateValue . "'";
array_push($wheres, $startDateQuery);
}
if ($_POST['endDate'] != "") {
$endDateValue = strtotime($_POST['endDate']);
$endDateQuery = "timestamp < '" . $endDateValue . "'";
array_push($wheres, $endDateQuery);
}
if (isset($_POST['uploader'])) {
$uploaders = $_POST['uploader'];
$uploaderArray = "(";
for ($i = 0; $i < count($uploaders); $i++) {
$uploaderArray .= $uploaders[$i] . ',';
}
$uploaderArray = substr($uploaderArray, 0, -1) . ')';
$uploaderQuery = "uploader IN " . $uploaderArray;
array_push($wheres, $uploaderQuery);
}
//create query
$searchQuery = "SELECT *, file.id AS fileId FROM file, user WHERE file.uploader = user.id";
for ($i = 0; $i < count($wheres); $i++) {
$searchQuery .= " AND " . $wheres[$i];
}
$searchQuery .= " ORDER BY file.id DESC";
$filesQuery = getQuery($searchQuery);
$stringOfFiles = "";
while ($row = mysqli_fetch_assoc($filesQuery)) {
$uploader = $row['uploader'];
$name = $row['display_name'];
$timestamp = $row['timestamp'];
$date = date('d.m.Y H:i', $timestamp);
$filename = $row['name'];
$stringOfFiles .= getImageTags($filename) . '<a href="download.php?id=' . $row['fileId'] . '" target="_blank">' . $row['name'] . ' ' . getString("uploadedBy") . ' ' . $name . ' ' . $date . '</a>' . ' ' . '<a href="#" onClick= "shareFile(' . $row['fileId'] . ')">' . getString("shareFile") . '</a><br>';
}
return $stringOfFiles;
}
示例3: loginUser
public function loginUser()
{
$o = new SaeTOAuthV2(WB_AKEY, WB_SKEY);
$code = getQuery('code');
if (isset($code)) {
$keys = array();
$keys['code'] = $code;
$keys['redirect_uri'] = WB_CALLBACK_URL;
try {
$tokenData = $o->getAccessToken('code', $keys);
} catch (OAuthException $e) {
}
}
if ($tokenData) {
$token = $tokenData['access_token'];
$userData = $this->loadData($token);
$data['uid'] = $this->userID;
$data['nick'] = $this->userName;
$data['pictureBig'] = $this->pictureBig;
$data['pictureSmall'] = $this->pictureSmall;
$data['access_token'] = $token;
$data['mobile'] = $this->mobile;
setMyCookie('weiboAuthToken', $data);
//setcookie( 'weibojs_'.$o->client_id, http_build_query($tokenData));
return true;
} else {
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>UGG</title>
</head>
<body>
<script type="text/javascript">
window.close();
</script>
</body>
</html>
<?php
}
}
示例4: mostUsedWordsAndEmoticons
function mostUsedWordsAndEmoticons($user, $shortcuts)
{
if ($user == null) {
$content = getQuery("SELECT content FROM message");
} else {
$content = getQuery("SELECT content FROM message WHERE author = {$user}");
}
$words = array();
$emoticons = array();
$numWords = 0;
$numEmoticons = 0;
while ($row = mysqli_fetch_assoc($content)) {
$message = $row['content'];
$exploded = preg_split('/\\s+/', $message);
foreach ($exploded as $word) {
if (isEmoticon($word, $shortcuts)) {
$numEmoticons++;
if (array_key_exists($word, $emoticons)) {
$emoticons[$word] += 1;
} else {
$emoticons[$word] = 1;
}
} else {
$word = str_replace('<br', '', $word);
$stripped = preg_replace('/[^[:alnum:][:space:]]/u', '', strtolower($word));
if ($stripped != '') {
$numWords++;
if (array_key_exists($stripped, $words)) {
$words[$stripped] += 1;
} else {
$words[$stripped] = 1;
}
}
}
}
}
asort($words);
$words = array_reverse($words);
asort($emoticons);
$emoticons = array_reverse($emoticons);
return array($words, $emoticons, $numWords, $numEmoticons);
}
示例5: addMetadata
function addMetadata($data, &$Config, $types, $facets, $namespaces)
{
$datasetUri = 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']) . '/';
$documentUri = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$documentUri = array_shift(explode('?', $documentUri));
if ($query = getQuery()) {
$documentUri .= '?' . $query;
}
if (isset($data[$documentUri])) {
$documentUri .= '&_output=turtle';
}
$DocumentGraph = new Graph($documentUri, $data);
$count = 1;
foreach ($data as $uri => $props) {
$prop = rdf_ns . '_' . $count++;
$DocumentGraph->setResource($prop, $uri);
}
if ($documentUri != $datasetUri) {
$DocumentGraph->setResource(void_ns . 'inDataset', $datasetUri);
} else {
$DocumentGraph->setResource(rdf_ns . 'type', void_ns . 'Dataset');
foreach ($types as $type => $entities) {
$classPartition = $DocumentGraph->setResource(void_ns . 'classPartition', $datasetUri . '?rdf:type=' . curie($type));
$classPartition->setResource(void_ns . 'class', $type);
$classPartition->setLiteral(void_ns . 'entities', $entities);
}
foreach ($namespaces as $ns => $n) {
$vocabUri = preg_replace('@#$@', '', $ns);
$DocumentGraph->setResource(void_ns . 'vocabulary', $vocabUri);
}
}
if (!empty($Config->license)) {
$DocumentGraph->setResource(dcterms_ns . 'license', $Config->license);
}
if (!empty($Config->name)) {
$DocumentGraph->setLiteral(dcterms_ns . 'title', $Config->name);
}
return $DocumentGraph->getIndex();
}
示例6: REPORTS
if ($condition1 != "none" && $condition2 == "dne") {
$sql_query .= " AND it." . $condition1 . "!='" . $conditionval . "'";
}
}
$save_query = 'INSERT INTO REPORTS (user_id,query,report_name) VALUES ("' . $user . '","' . $sql_query . '","' . $fname . '")';
$result = mysql_query($sql_query, $database);
if (mysql_num_rows($result) != 0 || $result) {
$secondresult = mysql_query($save_query, $database);
}
if (!$result) {
echo mysql_errno($database) . ": " . mysql_error($database) . "\n";
echo $sql_query;
}
return $result;
}
$result = getQuery($user, $column1, $column2, $column3, $condition1, $condition2, $conditionval, $fname, $database);
$fields_num = mysql_num_fields($result);
//echo "<h1>Table: {$table}</h1>";
echo "<table style='padding-left: 9cm' border='1'><tr>";
// printing table headers
for ($i = 0; $i < $fields_num; $i++) {
$field = mysql_fetch_field($result);
echo "<td><b>{$field->name}</b></td>";
}
echo "</tr>\n";
//echo "<table>";
while ($row = mysql_fetch_assoc($result)) {
echo '<tr>';
foreach ($row as $field) {
echo '<td>' . htmlspecialchars($field) . '</td>';
}
示例7: encryptAES128CBC
return encryptAES128CBC($data, $key, $key);
}
function isAdmin($query, $key)
{
$data = decryptAES128CBC($query, $key, $key);
if (preg_match('/^[\\x{21}-\\x{7E}]*$/', $data)) {
return strpos($data, ';admin=true;') !== false;
}
throw new Exception($data);
}
// don't output if we're included into another script.
if (!debug_backtrace()) {
$key = getRandomBytes(16);
// 0..............f|0..............f|0..............f|0..............f
// comment1=cooking|%20MCs;userdata=
// | |userdata
// ;comment|2=%20like%20a%20pound%20of%20bacon
$query = getQuery('userdata', $key);
$brokenQuery = substr($query, 0, 16) . str_repeat("", 16) . substr($query, 0, 16);
try {
isAdmin($brokenQuery, $key);
} catch (Exception $e) {
$error = $e->getMessage();
$recoveredKey = substr($error, 0, 16) ^ substr($error, 32);
print "Keys match:\n";
print $key === $recoveredKey ? "Yes\n\n" : "No :(\n\n";
$query = encryptAES128CBC('comment1=cooking%20MCs;userdata=x;admin=true;comment2=%20like%20a%20pound%20of%20bacon', $recoveredKey, $recoveredKey);
}
print "Querystring has admin=true:\n";
print isAdmin($query, $key) ? "Yes\n\n" : "No :(\n\n";
}
示例8: ucwords
$store->indexPredicates = false;
}
$title = ucwords($dataset);
if (isset($_GET['_reload'])) {
set_time_limit(0);
$store->reset();
$data_file = $Config->{$dataset}->data;
if (!is_file($data_file)) {
throw new Exception("{$data_file} could not be found");
}
$store->loadDataFile($data_file);
// $store->loadData(file_get_contents($data_file));
// $this->createHierarchicalIndex();
}
$types = $store->getTypes();
$query = getQuery();
$page = 1;
$offset = isset($_GET['_page']) && ($page = $_GET['_page']) ? ($_GET['_page'] - 1) * 10 : 0;
$showMap = strpos($query, '_near') !== false || isset($_GET['_near']) ? true : false;
if (!empty($query)) {
//query based title
list($path, $value) = explode('=', $query);
$value = curie($value);
$title = local($value);
if ($path == 'rdf:type') {
$title = plural($title);
} else {
$title = local($path) . ': ' . $title;
}
$data = $store->query($query, 10, $offset);
} else {
示例9: header
break;
}
//switch
$trimCharlist = "..";
header("Content-Type: text/xml");
/* verify have enough to continue - set defaults for missing parameters as long as they are not
mandatory
At the moment, no required Fields - If all fields are null, a record will be inserted and
the new userID returned.
*/
$link = mysqli_connect(Config::getDatabaseServer(), Config::getDatabaseUser(), Config::getDatabasePassword(), Config::getDatabase());
if (!$link) {
// Server error
mydie("Error connecting to Database");
}
$sql = getQuery($operation, $link, $_REQUEST);
if (Config::getDebug()) {
$LOG->log("{$sql}", PEAR_LOG_INFO);
}
$rc = mysqli_multi_query($link, $sql);
if (!$rc) {
}
if ($operation == 'updatebankbalance') {
} else {
}
header('HTTP/1.1 200 OK');
$link->close();
/* Close Database */
//return xml
$userSettings = new goUserSettings($userID);
if (isset($userSettings)) {
示例10: calcConnectionDirectConnection
function calcConnectionDirectConnection($first, $second, $startlimit, $maxdepth, $depth, $ignoredObjects, $ignoredPredicates, $fullconnection)
{
$time = microtime(true);
mysql_connect($GLOBALS['host'], $GLOBALS['user'], $GLOBALS['password']);
mysql_select_db($GLOBALS['db']);
//fuer alte Links
if (isset($_GET['maxdepth'])) {
$maxdepth = $_GET['maxdepth'] + 1;
}
$foundconnection = false;
$limit = $startlimit;
$idcounter = 0;
$htmlcounter = 0;
$saveRow = array();
//ignorierte Objekte/Praedikate kommen als Array an => Umrechnung in String fuer URL
for ($i = 0; $i < count($ignoredObjects); $i++) {
$permalinkIgnoreObjects .= '&ignoreObject_' . $i . '=' . $ignoredObjects[$i];
}
for ($i = 0; $i < count($ignoredPredicates); $i++) {
$permalinkIgnorePredicates .= '&ignorePredicate_' . $i . '=' . $ignoredPredicates[$i];
}
//Ueberpruefung, ob gegebene Anfrage schon gespeichert ist
include "queries.inc.php";
$savedIndex = isSaved($first, $second, $limit, $maxdepth, $depth, $ignoredObjects, $ignoredPredicates);
//Falls gegebene Anfrage schon gespeichert ist=> Ausgeben
if (is_int($savedIndex)) {
$lastdepth = -1;
for ($i = 0; $i < count($queries[$savedIndex]['savedResult']['row']); $i++) {
echo $lastdepth != $queries[$savedIndex]['savedResult']['depth'][$i] ? '<table style="border:solid 1px #FF8040;margin-left:2px;"><tr><td style="background-color:#e4e4e4;border:1px solid #CFCFCF;">Distance: ' . ($queries[$savedIndex]['savedResult']['depth'][$i] + 1) . '</td></tr>' : '';
printResults($queries[$savedIndex]['savedResult']['row'][$i], $htmlcounter, $idcounter, $first, $second);
echo $queries[$savedIndex]['savedResult']['depth'][$i] != $queries[$savedIndex]['savedResult']['depth'][$i + 1] || !isset($queries[$savedIndex]['savedResult']['depth'][$i + 1]) ? '</table><br>' : '';
$lastdepth = $queries[$savedIndex]['savedResult']['depth'][$i];
}
echo 'This is a cached result. It was saved on ' . date('r', $queries[$savedIndex]['saveTime']) . '.<br>';
$queries[$savedIndex]['clickCount']++;
file_put_contents('queries.inc.php', "<?\n\$queries=" . var_export($queries, true) . ";\n?>");
} else {
if ($GLOBALS['usingClusterTable'] == true && $fullconnection == false) {
$clusterConSwitch = calcConnectionCluster($first, $second, $maxdepth);
if (is_Int($clusterConSwitch)) {
$depth = $clusterConSwitch;
echo 'We are now searching the complete data set for connections. Meanwhile, you may have a look at a preview result <a href="#" onclick="loadClusterConnection(\'ajax.php?f=6&first=' . str_replace("%", "__perc__", $first) . '&second=' . str_replace("%", "__perc__", $second) . $permalinkIgnoreObjects . $permalinkIgnorePredicates . '\')" title="Load Cluster Connection">here</a>.<br><br>';
echo '<div id="clusterCon" style="display:none;"></div>';
echo '<div id="ib_1000" style="position:absolute;top:500px;left:20%;width:200px;height:100px;"></div>';
#echo ', or maybe you want to <a href="'.substr($_SERVER['PHP_SELF'],0,-strlen($_SERVER['SCRIPT_NAME'])).'index.php?firstObject='.$first.'&secondObject='.$second.'&limit='.$startlimit.'&maxdistance='.$maxdepth.$permalinkIgnoreObjects.$permalinkIgnorePredicates.'&fullc=true&saved=saved">load the full Results</a>?<br><br>';
$fullconnection = true;
} else {
if ($clusterConSwitch == 'notenoughdistance') {
echo 'For a Preview Result click <a href="#" onclick="loadClusterConnection(\'ajax.php?f=6&first=' . str_replace("%", "__perc__", $first) . '&second=' . str_replace("%", "__perc__", $second) . $permalinkIgnoreObjects . $permalinkIgnorePredicates . '\')" title="Load Cluster Connection">here</a>.<br>';
echo '<div id="clusterCon" style="display:none;"></div>';
echo '<div id="ib_0" style="position:absolute;top:500px;left:20%;width:200px;height:100px;"></div>';
}
}
}
if ($fullconnection == true || $GLOBALS['usingClusterTable'] == false) {
ob_flush();
flush();
do {
//Berechnung der Verbindung, falls dieses moeglich ist
$res = mysql_query(getQuery($depth, $first, $second, $limit, $ignoredObjects, $ignoredPredicates)) or die(mysql_error());
if (mysql_num_rows($res) > 0) {
$limit = $limit - mysql_num_rows($res);
$foundconnection = true;
echo '<table style="border:solid 1px #FF8040;margin-left:2px;"><tr><td style="background-color:#e4e4e4;border:1px solid #CFCFCF;">Distance: ' . ($depth + 1) . '</td></tr>';
while ($row = mysql_fetch_row($res)) {
printResults($row, $htmlcounter, $idcounter, $first, $second);
$saveRow['row'][] = $row;
$saveRow['depth'][] = $depth;
}
echo '</table><br>';
} else {
if ($depth == $maxdepth - 1) {
echo "No Connection Found at max. Distance {$maxdepth} !<br><br>";
//f�r maximale Tiefe Fehlschlag ausgeben
#if ($GLOBALS['usingClusterTable']==true)
#calcConnectionCluster($first,$second,$maxdepth,true);
}
}
$depth++;
} while ($depth < $maxdepth && $limit > 0);
if ($foundconnection == true) {
//Queries koennen abgespeichert werden, wenn eine Verbindung gefunden wurde
echo '<span style="padding-left:2px;">Would you like to <a href="#" title="save Query" onmousedown="saveQuery(\'ajax.php?f=3&first=' . str_replace("%", "__perc__", $first) . '&second=' . str_replace("%", "__perc__", $second) . '&limit=' . $startlimit . '&maxdepth=' . $maxdepth . $permalinkIgnoreObjects . $permalinkIgnorePredicates . '&depth=' . $depth . '\',\'' . str_replace('%', '__perc__', str_replace('"', '__quot__', serialize($saveRow))) . '\');">save</a> your query?</span><br>';
echo '<span style="padding-left:2px;"><div id="save"> </div></span><br>';
}
}
}
echo 'Result obtained in ' . round(microtime(true) - $time, 3) . ' seconds.<br>';
}
示例11: foreach
foreach ($result_img as $img) {
$url = $modx->getOption("upload_dir") . $img['name'];
$r['url'] = $url;
if ($num_imgs == 1) {
$stuff_images = $url;
} else {
$stuff_images .= getChunk($stuff_img_html, $r);
}
}
if ($num_imgs == 1) {
$stuff_images = "<div class=\"item-photo-one\"><img src=\"" . $stuff_images . "\" alt=\"" . htmlspecialchars($result[0]['name']) . "\" class=\"im\"></div>";
} else {
$stuff_images = "<div class=\"item-photos\">" . $stuff_images . "</div>";
}
$query_material = "SELECT `value` FROM `modx_items_prop` WHERE `key` = 'Материал' AND `item_code_1c`='" . $stuff_code_1c . "' ";
$result_material = getQuery($query_material, $path);
$keywords = htmlspecialchars($result[0]['keywords']);
$description = htmlspecialchars($result[0]['description']);
$title = $result[0]['title'];
if (!$title) {
$title = $result[0]['name'];
}
$title = htmlspecialchars($title);
// TODO: Выполнить рефакторинг с использованием массива данных $props и $modx->setPlaceholders(array $props, $prefix);
$modx->setPlaceholder("stuff_id", $stuff_code_1c);
$modx->setPlaceholder("stuff_name", $result[0]['name']);
$modx->setPlaceholder("stuff_h1", $result[0]['h1']);
$modx->setPlaceholder("stuff_title", $title);
$modx->setPlaceholder("stuff_description", $description);
$modx->setPlaceholder("stuff_keywords", $keywords);
$modx->setPlaceholder("imgalt_name", htmlspecialchars($result[0]['name']));
示例12: getQuery
</table>
<table id="results">
<?php
// Only runs the following if user has selected something
if (isset($_POST['movieID']) && $_POST['movieID'] != -1 || isset($_POST['director']) && $_POST['director'] != -1 || isset($_POST['genre']) && $_POST['genre'] != -1 || isset($_POST['rating']) && $_POST['rating'] != -1) {
$searchMovie = $_POST['movieID'];
$searchDirector = $_POST['director'];
$searchGenre = $_POST['genre'];
$searchRating = $_POST['rating'];
echo "<tr><td class='center' colspan='100'>✰ Your Movie Results ✰</td></tr>";
echo "<tr><th>Movie Title</th>";
echo "<th>Director</th>";
echo "<th>Genre</th>";
echo "<th>Rating</th></tr>";
$results = getQuery($searchMovie, $searchDirector, $searchGenre, $searchRating);
foreach ($results as $resultDisplay) {
echo "<tr>";
echo "<td><a href='moreInfo.php?id=" . $resultDisplay['movieID'] . "'>" . $resultDisplay['title'] . "</a></td>";
echo "<td>" . $resultDisplay['director'] . "</td>";
echo "<td>" . $resultDisplay['genre'] . "</td>";
echo "<td>" . $resultDisplay['rating'] . "</td>";
echo "</tr>";
}
// Puts search results into a table
foreach ($results as $inputs) {
$sql = "INSERT INTO temp_movie_length\n\t\t\t\t\t\tVALUES('" . $inputs['length'] . "')";
$stmt = $conn->prepare($sql);
$stmt->execute();
}
$maxYear = getMaxYear();
示例13: renewSession
function renewSession()
{
if (isset($_COOKIE['usercookie'])) {
$cookie = $_COOKIE['usercookie'];
$cookieResult = mysqli_fetch_array(getQuery("SELECT id FROM user_session WHERE token ='{$cookie}'"));
if (!empty($cookieResult)) {
$id = $cookieResult['id'];
$_SESSION['user'] = mysqli_fetch_array(getQuery("SELECT * FROM user WHERE id ='{$id}'"));
}
}
}
示例14: uploadUserOrChatImage
function uploadUserOrChatImage($file, $uploader, $savePath, $maxSize, $type)
{
$originalFileName = $file["name"][0];
$uploadTime = time();
$fileSize = $file["size"][0];
//Create unique id for file
$fileIdresult = getQuery("SELECT * FROM file WHERE id=(SELECT MAX(id) FROM file)");
$newFileIdAssoc = $fileIdresult->fetch_assoc();
$newFileId = $newFileIdAssoc["id"] + 1;
//check if file is an image:
$mime = mime_content_type($file['tmp_name'][0]);
if (!strstr($mime, "image/")) {
printJson('{"status": "failure", "message": " ' . $originalFileName . ' ' . getString('notAnImage') . '."}');
return;
}
//Format for filename 'id.fileExtension'
$newFileName = $newFileId . substr($originalFileName, strrpos($originalFileName, '.'));
if ($fileSize > $maxSize) {
printJson('{"status": "failure", "message": " ' . $originalFileName . ' ' . getString('fileIsTooLarge') . '."}');
return;
}
//Add to database
setQuery("INSERT INTO file (path, uploader, name, mime_type, timestamp) VALUES ('{$newFileName}', '{$uploader}', '{$originalFileName}','{$mime}', '{$uploadTime}')");
$success = move_uploaded_file($file['tmp_name'][0], $savePath . $newFileName);
if ($success && $type == "userImage") {
setUserImage($uploader, $newFileId);
printJson('{"status": "success", "message": " ' . getString('theFile') . ' ' . $originalFileName . ' ' . getString('wasUploaded') . '."}');
} elseif ($success && $type == "chatImage") {
setChatImage($newFileId, $uploader);
printJson('{"status": "success", "message": " ' . getString('theFile') . ' ' . $originalFileName . ' ' . getString('wasUploaded') . '."}');
} else {
printJson('{"status": "success", "message": "' . getString('uploadFailed') . '."}');
}
}
示例15: getQuery
$query = "SELECT `name`, `entry`.id, `coralId`, `year`, `month`, `day`, `avatar`, `coralDescription`, `description`, `rarity`, `venomous` FROM `entry` INNER JOIN `coral` ON `entry`.coralId =`coral`.id WHERE `entry`.id = " . $entryId;
getQuery($query, $connect);
break;
case 'editEntry':
$entryId = $_GET['entryId'];
$description = $_GET['description'];
$query = "UPDATE `entry` SET `description` = '" . $description . "' WHERE `id` = " . $entryId;
mysqli_query($connect, $query);
echo json_encode(["Edit success"]);
break;
case 'deleteEntry':
$entryId = $_GET['entryId'];
$query = "DELETE FROM `entry` WHERE `id` = " . $entryId;
mysqli_query($connect, $query);
echo json_encode(["Delete success"]);
break;
case 'getReviewEntries':
$query = "SELECT `name`, `entry`.id, `year`, `month`, `day`, `time`, `avatarThumbnail` FROM `entry` INNER JOIN `coral` ON `entry`.coralId =`coral`.id WHERE `userId` = " . $userId . " AND `status` = 0 ORDER BY `entry`.id DESC;";
getQuery($query, $connect);
break;
}
function getQuery($query, $connect)
{
$results = mysqli_query($connect, $query);
$resultArray = [];
while ($row = mysqli_fetch_assoc($results)) {
$resultArray[] = $row;
}
echo json_encode($resultArray);
exit;
}