当前位置: 首页>>代码示例>>PHP>>正文


PHP MyDB::querySingle方法代码示例

本文整理汇总了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>';
开发者ID:harisahmed,项目名称:WEB-CRAWLING-PROJECT-1,代码行数:31,代码来源:index.php

示例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);
}
开发者ID:ndrix,项目名称:xwindow-redirect,代码行数:31,代码来源:status.php


注:本文中的MyDB::querySingle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。