DByte\DB::column PHP Method

column() static public method

Fetch a column offset from the result set (COUNT() queries)
static public column ( string $query, array $params = NULL, integer $key ) : array | null
$query string query string
$params array query parameters
$key integer index of column offset
return array | null
    static function column($query, $params = NULL, $key = 0)
    {
        if ($statement = DB::query($query, $params)) {
            return $statement->fetchColumn($key);
        }
    }

Usage Example

Beispiel #1
0
DB::$c = $pdo;
ob_flush();
flush();
$row_break_counter = 0;
for ($i = 0; $i < $nrows; $i++) {
    $row = mysqli_fetch_array($result);
    extract($row);
    if ($row_break_counter == 0) {
        echo "<div class=\"row\">";
    }
    $row_break_counter = $row_break_counter + 1;
    echo "<div class=\"col-lg-4\">";
    $ColID = DB::column('SELECT ColID FROM `Sounds` WHERE SoundID = ' . $SoundID);
    $SiteID = DB::column('SELECT SiteID FROM `Sounds` WHERE SoundID = ' . $SoundID);
    $DirID = DB::column('SELECT DirID FROM `Sounds` WHERE SoundID = ' . $SoundID);
    $small_spectrogram = DB::column('SELECT ImageFile FROM `SoundsImages` WHERE ImageType="spectrogram-small" AND SoundID = ' . $SoundID);
    $small_spectrogram_path = "sounds/images/{$ColID}/{$DirID}/{$small_spectrogram}";
    if (!is_file("{$absolute_dir}/{$small_spectrogram_path}")) {
        $small_spectrogram_path = "images/notready-small.png";
    }
    echo "<a href=\"db_filedetails.php?SoundID={$SoundID}\" title=\"Click for file details and more options\">\n\t\t<img src=\"{$small_spectrogram_path}\" width=\"300\" height=\"150\" style=\"margin-top: 20px;\"><br>\n\t\t{$SoundName}</a>";
    if (isset($Date_h) && $Date_h != "") {
        echo "<br>{$Date_h} | {$Time}";
    }
    if (!isset($show_tags)) {
        $show_tags = 0;
    }
    flush();
    @ob_flush();
    #Check if there are images
    $query_img = "SELECT COUNT(*) FROM SoundsImages WHERE SoundID='{$SoundID}'";
All Usage Examples Of DByte\DB::column