0
我正在嘗試爲我的網站的新聞部分創建一個「加載更多」按鈕,但每當我嘗試任何操作時,我的大腦都會變得空白,我不知道如何開始製作它。 我不擅長任何JavaScript/jquery/ajax只是「一些」的PHP。用jquery&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">');
}
}
通常被稱爲[無限滾動](http://www.jquery4u.com/tutorials/jquery-infinite-scrolling-demos/) – Blazemonger
只是PHP你開玩笑:) 1.很酷的格式,2.爲什麼使用fetch_array如果你甚至沒有使用它? 3.做兩個查詢,你必須只做一個? 4.「我的想法」是什麼?所以你想編程?首先通過一些教程學習,然後構建你的腦袋,然後創建它。 5.從google.com開始,如果你的問題不是這樣,你可能得不到其他任何建議:爲我做這件事,因爲我的頭腦變得空白^^順便說一句。限制10,點擊限制10,20。 –