$.ajax({
url:'ajaxappendindex.php',
method:'POST',
data:{"startFrom":startFrom},
beforeSend:function(){inProgress=true;
}
}).done(function(data){
data=jQuery.parseJSON(data);
if(data.length>0){
$.each(data, function(index, data){
$("#div").append('+data.title+'');
});
$startFrom = $_POST['startFrom'];
$sql = "SELECT * FROM articles DESC LIMIT ".$startFrom.", 4";
$res = mysqli_query($conn, $sql);
$articles = array();
while ($row = mysqli_fetch_assoc($res)){$articles[] = $row;}
echo json_encode($articles);
$sql = "SELECT * FROM youtube JOIN marketdata2 ON channelTitle=coin WHERE youtube.videoId NOT IN (SELECT videoId FROM watchedvideo WHERE userkey = '$userkey') ORDER BY `publishedAt` DESC LIMIT ".$startFrom.", 4";
<?php
include "db.php";
$startFrom = $_POST['startFrom'];
$sql = "SELECT * FROM youtube JOIN marketdata2 ON channelTitle=coin WHERE youtube.videoId NOT IN (SELECT videoId FROM watchedvideo WHERE userkey = '$userkey') ORDER BY `publishedAt` DESC LIMIT ".$startFrom.", 4";
$res = mysqli_query($conn, $sql);
$articles = array();
while ($row = mysqli_fetch_assoc($res)){$articles[] = $row;}
echo json_encode($articles);
?>
<?php
$servername = "localhost";
$database = "database ";
$username = "username";
$password = "password ";
$conn = mysqli_connect($servername, $username, $password, $database);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
mysqli_set_charset($conn, "utf8");
?>