I’ve written a page that has a php include. Here is the result. http://www.friendship-church.org/MobileApp/index.html#asian
The page gets data from a MySQL database which is nifty. My question is, why does it list the data twice? It seems to go through a loop two times.
Here is my php code:
[php]<?php
if(isset($_POST[‘limit’])){
$limit = preg_replace(’#[^0-9]#’, ‘’, $_POST[‘limit’]);
require_once(“inc/conn.php”);
$i = 0;
$sqlString = “SELECT * FROM tblsermons where Campus = ‘Shakopee’ and SermonPath = ‘Nextweek’ order by Date1 DESC limit $limit”;
$query = mysql_query($sqlString) or die (mysql_error());
while ($row = mysql_fetch_array($query)) {
$i++;
$date1 = $row["date1"];
$Title = $row["Title"];
$Pastor = $row["Pastor"];
$jsonData .= ' '.$date1.' - '.$Title.' - '.$Pastor.' <br> ';
}
echo $jsonData;
}
?>
[/php]