如何使負載更多按鈕工作,使限制0,5轉換爲限制0,10,並在第三次點擊它將轉換爲限制0,15和最大值達到LIMIT 0,30PHP中的AJAX更多按鈕獲取更多記錄
我使用下面的PHP,MySQL的從數據庫
$select_resdetails = mysql_query("SELECT *, ((ACOS(SIN(-27.486204 * PI() /180) * SIN(`store-latitude` * PI() /180) + COS(-27.486204 * PI() /180) * COS(`store-latitude` * PI() /180) * COS((152.994962 - `store-longitude`) * PI() /180)) *180/PI()) *60 * 1.1515) AS `distance` FROM (SELECT max(if(`field_name`='store-name', `field_value`, null)) AS `store-name`,
max(if(`field_name`='store-description', `field_value`, null)) AS `store-description`, max(if(`field_name`='store-longitude', `field_value`, null)) AS `store-longitude`, max(if(`field_name`='store-latitude', `field_value`, null)) AS `store-latitude` FROM `wp_cf7dbplugin_submits` WHERE `form_name` = 'Add Store' GROUP BY `submit_time`) A ORDER BY `distance` LIMIT 0,5");
?>
<form class="ui-filterable">
<input id="myFilter" data-type="search">
</form>
<ul data-inset="true" data-role="listview" data-filter="true" data-input="#myFilter" style="padding:0px;">
<?php
while($fetch_resdetails = mysql_fetch_array($select_resdetails)) {
echo '<li>
<h2>' . $fetch_resdetails['store-name'] . '</h2>
<p>' . number_format(($fetch_resdetails['distance']), 2, '.', '') . ' KM <em>' . $fetch_resdetails['store-description'] . '</em></p>
</a>
</li>
';
}
?>
<input type="button" value="Load More" />
</ul>
你能縮小你的代碼,實際上是解決問題的一部分?如果所有這些都是必要的,也許它不是op問題的正確答案。 –