本文整理汇总了PHP中DibiConnection::fetchSingle方法的典型用法代码示例。如果您正苦于以下问题:PHP DibiConnection::fetchSingle方法的具体用法?PHP DibiConnection::fetchSingle怎么用?PHP DibiConnection::fetchSingle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DibiConnection
的用法示例。
在下文中一共展示了DibiConnection::fetchSingle方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: moveFile
public function moveFile($fileId, $id, $fromFileId = false)
{
if ($fromFileId) {
$folderId = $this->connection->fetchSingle("SELECT [folder_id] FROM [:vd:pages_files] WHERE [file_id]=%i", $fromFileId);
if ($folderId) {
return $this->connection->query("UPDATE [:vd:pages_files] SET [folder_id]=%i WHERE [file_id]=%i", $folderId, $fileId);
} else {
throw new \Exception('Destination folder not found.');
}
}
return $this->connection->query("UPDATE [:vd:pages_files] SET [folder_id]=%i WHERE [file_id]=%i", $id, $fileId);
}
示例2: DibiConnection
<?php
require_once 'vendor/autoload.php';
require_once 'config.php';
use Dibi\Dibi;
$db = new DibiConnection($database_configuration);
if (isset($_COOKIE['language'])) {
$locale = $db->fetchSingle('SELECT locale FROM Languages WHERE code="' . $_COOKIE['language'] . '"');
putenv("LC_ALL={$locale}");
setlocale(LC_ALL, $locale);
bindtextdomain($text_domain, $base_dir . "/i18n");
textdomain($text_domain);
}
switch (isset($_GET['q']) ? $_GET['q'] : '') {
case "selectlanguage":
$rows = $db->query("SELECT code, name FROM Languages WHERE supported = 1");
echo "<option value='' selected></option>";
foreach ($rows as $row) {
echo "<option value='" . $row['code'] . "'>" . $row['name'] . "</option>";
}
break;
case "savetext":
$language = mysql_real_escape_string(isset($_POST['language']) ? $_POST['language'] : '');
// It will be possible to use Null Coalesce Operator in PHP 7, see: https://wiki.php.net/rfc/isset_ternary
$title = mysql_real_escape_string(isset($_POST['title']) ? $_POST['title'] : '');
$text = mysql_real_escape_string(isset($_POST['text']) ? $_POST['text'] : '');
$level = mysql_real_escape_string(isset($_POST['level']) ? $_POST['level'] : '');
$source = mysql_real_escape_string(isset($_POST['source']) ? $_POST['source'] : '');
$url = mysql_real_escape_string(isset($_POST['url']) ? $_POST['url'] : '');
$public = mysql_real_escape_string(isset($_POST['pub']) ? $_POST['pub'] : '');
$db->query("INSERT INTO Texts (language,title,text,level,source,url,public) VALUES ('" . $language . "','" . $title . "','" . $text . "','" . $level . "','" . $source . "','" . $url . "','" . $public . "')");
示例3: existsRepositoryWithName
/**
* @param string $repositoryName
* @return boolean
*/
protected function existsRepositoryWithName($repositoryName)
{
return (bool) $this->dibiConnection->fetchSingle("SHOW TABLES LIKE %s;", $repositoryName);
}
示例4: DibiConnection
<?php
require_once '../vendor/autoload.php';
require_once '../config.php';
use Dibi\Dibi;
$db = new DibiConnection($database_configuration);
if (isset($_COOKIE['language'])) {
$currentLanguage = $_COOKIE['language'];
} else {
$currentLanguage = $default_language;
}
$locale = $db->fetchSingle('SELECT locale FROM Languages WHERE code="' . $currentLanguage . '"');
putenv("LC_ALL={$locale}");
setlocale(LC_ALL, $locale);
bindtextdomain($text_domain, $base_dir . "/i18n");
textdomain($text_domain);
echo 'var currentLanguageI18n = "' . $currentLanguage . '",';
echo 'showSolutionI18n = "' . _('Show the solution') . '",';
echo 'showOriginI18n = "' . _('Show the original text') . '",';
echo 'showTestI18n = "' . _('Show the test') . '",';
echo 'checkTestI18n = "' . _('Check the test') . '",';
echo 'textIsPerfectI18n = "' . _('The text is perfect now.') . '",';
echo 'textIsNotCorrectI18n = "' . _('The text is not quite correct yet.') . '",';
echo 'selectLanguageI18n = "' . _('Choose your language') . '",';
echo 'selectLevelI18n = "' . _('Choose your language level') . '",';
echo 'levelI18n = "' . _('Language level') . '",';
echo 'selectTextI18n = "' . _('Choose a text') . '",';
echo 'selectTestTypeI18n = "' . _('Choose a test type') . '",';
echo 'formTextI18n = "' . _('or insert a text here.') . '",';
echo 'formTitleInfoTextI18n = "' . _('Would you like to save the text to the database?') . '",';
echo 'formTitleInfoTestI18n = "' . _('Would you like to save the test to the database?') . '",';
示例5: setcookie
$minimise = ".min";
} else {
$minimise = "";
}
$row = $db->fetch('SELECT * FROM Tests WHERE secret="' . $secret . '" LIMIT 1');
$language = $row->language;
$textId = (int) $row->text;
$testTypeId = (int) $row->testtype;
$testText = $row->test;
$solution = $row->solution;
$level = $row->level;
$save = (bool) $row->save;
$public = (bool) $row->public;
if (strlen($language) == 2) {
setcookie('language', $language);
$locale = $db->fetchSingle('SELECT locale FROM Languages WHERE code="' . $language . '"');
} else {
$language = $default_language;
if (isset($_COOKIE['language'])) {
$locale = $db->fetchSingle('SELECT locale FROM Languages WHERE code="' . $_COOKIE['language'] . '"');
} else {
setcookie('language', $default_language);
$locale = $db->fetchSingle('SELECT locale FROM Languages WHERE code="' . $default_language . '"');
}
}
if ($language != "en") {
putenv("LC_ALL={$locale}");
setlocale(LC_ALL, $locale);
bindtextdomain($text_domain, $base_dir . "/i18n");
textdomain($text_domain);
}