Ejemplo n.º 1
0
    $constAmount = 15;
    // 2. изменение количества выводимого аудио
    $sAudio = getScreened($conn, 'sAudio');
    $sAudio = substr($sAudio, 0, 30);
    $a = array();
    $c = 0;
    if ($start == 0) {
        $result = mysqli_query($conn, "SELECT aud_id,name,surname,title,link,score,performer,audio.comp_id FROM audio \n                LEFT JOIN composition ON (audio.comp_id=composition.comp_id)\n                LEFT JOIN composer ON (composition.authors_id = composer.authors_id)\n                WHERE name LIKE '{$sAudio}%' OR surname LIKE '{$sAudio}%' OR title LIKE '{$sAudio}%' OR performer LIKE '{$sAudio}%' \n                ORDER BY {$sType}");
        $sum_of_audio = mysqli_num_rows($result);
        echo $sum_of_audio . ".;";
        if ($sum_of_audio < $constAmount) {
            $until = $sum_of_audio;
        } else {
            $until = $constAmount;
        }
        for ($i = 0; $i < $until; $i++) {
            $audioOut = mysqli_fetch_assoc($result);
            intoArray($audioOut, $conn);
        }
    } else {
        $result = mysqli_query($conn, "SELECT aud_id,name,surname,title,link,score,performer,audio.comp_id FROM audio \n                LEFT JOIN composition ON (audio.comp_id=composition.comp_id)\n                LEFT JOIN composer ON (composition.authors_id = composer.authors_id)\n                WHERE name LIKE '{$sAudio}%' OR surname LIKE '{$sAudio}%' OR title LIKE '{$sAudio}%' OR performer LIKE '{$sAudio}%' \n                ORDER BY {$sType} LIMIT {$start},{$constAmount}");
        while ($audioOut = mysqli_fetch_assoc($result)) {
            intoArray($audioOut, $conn);
        }
    }
    if ($c != 0) {
        echo json_encode($a);
    }
} else {
    echo 0;
}
Ejemplo n.º 2
0
    $sComp = substr($sComp, 0, 30);
    $sType = $_POST['sType'];
    $constAmount = 15;
    // 3. изменение колияества выводимого контента
    $a = array();
    $c = 0;
    if ($start == 0) {
        $result = mysqli_query($conn, "SELECT comp_id,composition.authors_id,title,name,surname,count \n                                   FROM composition LEFT JOIN composer ON (composition.authors_id=composer.authors_id)\n                                   WHERE name LIKE '{$sComp}%' OR surname LIKE '{$sComp}%' OR title LIKE '{$sComp}%' \n                                   ORDER BY {$sType}");
        $sum_of_comp = mysqli_num_rows($result);
        echo $sum_of_comp . ".;";
        if ($sum_of_comp < $constAmount) {
            $until = $sum_of_comp;
        } else {
            $until = $constAmount;
        }
        for ($i = 0; $i < $until; $i++) {
            $compRow = mysqli_fetch_assoc($result);
            intoArray($compRow);
        }
    } else {
        $compResult = mysqli_query($conn, "SELECT comp_id,composition.authors_id,title,name,surname,count \n                                        FROM composition LEFT JOIN composer ON (composition.authors_id=composer.authors_id)\n                                        WHERE name LIKE '{$sComp}%' OR surname LIKE '{$sComp}%' OR title LIKE '{$sComp}%' \n                                        ORDER BY {$sType} LIMIT {$start},{$constAmount}");
        while ($compRow = mysqli_fetch_assoc($compResult)) {
            intoArray($compRow);
        }
    }
    if ($c != 0) {
        echo json_encode($a);
    }
} else {
    echo 0;
}
Ejemplo n.º 3
0
    $constAmount = 15;
    // 2. изменение количества выводимого видео
    $sVideo = getScreened($conn, 'sVideo');
    $sVideo = substr($sVideo, 0, 30);
    $a = array();
    $c = 0;
    if ($start == 0) {
        $result = mysqli_query($conn, "SELECT name,surname,title,score,link,composition.comp_id,{$tType}.date,definition FROM {$tType} \n                LEFT JOIN composition ON ({$tType}.comp_id=composition.comp_id)\n                LEFT JOIN composer ON (composition.authors_id = composer.authors_id)\n                WHERE name LIKE '{$sVideo}%' OR surname LIKE '{$sVideo}%' OR title LIKE '{$sVideo}%' \n                ORDER BY {$sType}");
        $sum_of_video = mysqli_num_rows($result);
        echo $sum_of_video . ".;";
        if ($sum_of_video < $constAmount) {
            $until = $sum_of_video;
        } else {
            $until = $constAmount;
        }
        for ($i = 0; $i < $until; $i++) {
            $videoOut = mysqli_fetch_assoc($result);
            intoArray($videoOut, $conn);
        }
    } else {
        $result = mysqli_query($conn, "SELECT name,surname,title,score,link,composition.comp_id,{$tType}.date,definition FROM {$tType} \n                LEFT JOIN composition ON ({$tType}.comp_id=composition.comp_id)\n                LEFT JOIN composer ON (composition.authors_id = composer.authors_id)\n                WHERE name LIKE '{$sVideo}%' OR surname LIKE '{$sVideo}%' OR title LIKE '{$sVideo}%' \n                ORDER BY {$sType} LIMIT {$start},{$constAmount}");
        while ($videoOut = mysqli_fetch_assoc($result)) {
            intoArray($videoOut, $conn);
        }
    }
    if ($c != 0) {
        echo json_encode($a);
    }
} else {
    echo 0;
}