require_once "includes/config.php";
$num = $_GET['num'];
$res = mysqli_query($connection, "SELECT * FROM `videos` ORDER BY `id` DESC LIMIT $num, 10");
$row = mysqli_fetch_array($res);
echo json_encode($res);
$num = $_GET['num'];
$res = mysqli_query("SELECT * FROM `videos` ORDER BY `id` DESC LIMIT '".$num."', 10");
$videos = array();
while($row = mysqli_fetch_array($res)){
$videos[] = $row;
}
echo json_encode($videos);
require_once "includes/config.php";
$num = $_GET['num'];
$res = mysqli_query($connection, "SELECT * FROM `videos` ORDER BY `id` DESC LIMIT $num, 10");
$videos = array();
while($row = mysqli_fetch_array($res)){
$videos[] = $row;
}
echo json_encode($videos);
require_once "includes/config.php";
$num = $_GET("num");
$res = $db->query("SELECT * FROM `videos` ORDER BY `id` DESC LIMIT '$num', 10");
$videos = array();
while($row = $res->fetch_array(MYSQLI_ASSOC)){
$videos[] = $row;
}
echo json_encode($videos);
require_once "includes/config.php";
$num = $_GET("num");
$res = $db->query("SELECT * FROM `videos` ORDER BY `id` DESC LIMIT '$num', 10");
$videos = array();
while($row = $res->mysqli_fetch_array()){
$videos[] = $row;
}
echo json_encode($videos);
/*Обратите внимание, как я подключаюсь к базе. Почему так? Потому что так правильнее*/
$db = new mysqli('localhost','user','pass','database');
if(mysqli_connect_errno()){
echo mysqli_connect_error();
}
/*надеюсь не надо объяснять, что тут происходит?*/
require_once "includes/config.php";
$num = $_GET("num");
$res = $db->query("SELECT * FROM `videos` ORDER BY `id` DESC LIMIT '$num', 10");
$videos = array();
while($row = mysqli_fetch_array($res)){
$videos[] = $row;
}
echo json_encode($videos);
$.ajax({
url: 'load.php',
method: 'GET',
dataType: 'json',
data: "num="+num,
beforeSend: function(){
inProcess = true;
},
success: function(data){
console.log(data);
}
$num = $_GET("num");
echo $num;
$num = $_GET("num");
echo $num;