我正在尝试在我网站的新闻部分创建一个“加载更多”按钮,但是每当我尝试任何事情时,我的大脑都会一片空白,我不知道如何开始制作它。我不擅长任何 javascript/jquery/ajax 只是“一些”php。
到目前为止,我只有我的 php 脚本显示数据库中的所有新闻......
$sql = mysqli_query($con,"SELECT * FROM news ORDER BY date DESC")
or die (mysql_error());
while($row = mysqli_fetch_array($sql)){
$usql = mysqli_query($con,"SELECT * FROM members WHERE id = 1");
while($user = mysqli_fetch_array($usql)){
echo('<li class=""><br/>('.$row['date'].')');
echo ('<a href="/news/'.$row['id'].'" title="'.$user['username'].'" rel="nofollow">');
echo ('<img src="'.$row['img'].'" alt="'.$user['username'].'" class="list_intros_img">');
echo ('<h4><a href="/news/'.$row['id'].'" title="'.$user['username'].'">'.$row['title'].'</a></h4>');
echo ('<p>'.substr($row['content'],0,400).'</p>');
echo ('</li><hr class="line">');
}
}