Forum


23:07

29/08/2012

I have problem about loading data from mysql , i used xml loading data , i can see the form but there is no records in it, where i went wrong.
Here is my PHP file.
$page = $_GET['page']; // get the requested page
$limit = $_GET['rows']; // get how many rows we want to have into the grid
$sidx = $_GET['sidx']; // get index row – i.e. user click to sort
$sord = $_GET['sord']; // get the direction
if(!$sidx)
$sidx =1; // connect to the database
$result = mysqli_query($dbc, "SELECT COUNT(*) AS count FROM proizvodi");
$row = mysqli_fetch_array($result, MYSQL_ASSOC);
$count = $row['count'];
if( $count >0 ) {
$total_pages = ceil($count/$limit);
} else {
$total_pages = 0;
}
if ($page > $total_pages)
$page=$total_pages;
$start = $limit*$page – $limit; // do not put $limit*($page – 1)
$SQL = "SELECT *
FROM proizvodi
ORDER BY $sidx $sord
LIMIT $start , $limit
";
//echo $SQL;
$result = mysqli_query($dbc, $SQL) or die("CouldnÂ’t execute query.".mysql_error());
if ( stristr($_SERVER["HTTP_ACCEPT"],"application/xhtml+xml") ){
header("Content-type: application/xhtml+xml;charset=utf-8″);
} else {
header("Content-type: text/xml;charset=utf-8″);
}
$et = ">";
echo "<?xml version='1.0' encoding='utf-8'?$etn";
echo "<rows>";
echo "<page>".$page."</page>";
echo "<total>".$total_pages."</total>";
echo "<records>".$count."</records>";
//// be sure to put text data in CDATA
while($row = mysqli_fetch_array($result,MYSQL_ASSOC)) {
echo "<row id='". $row['id']."'>";
echo "<cell><![CDATA[". $row['id_grupe']."]]</cell>";
echo "<cell><![CDATA[". $row['naziv_proizvoda']."]]></cell>";
echo "<cell><![CDATA[". $row['aktivan']."]]</cell>";
echo "<cell>". $row['datum']."</cell>";
echo "</row>";
}
echo "</rows>";
?>
Most Users Ever Online: 715
Currently Online:
51 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66