Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
I cant load data with my JqGrid. Need Help :-)
29/08/2012
23:07
Avatar
belster
New Member
Members
Forum Posts: 2
Member Since:
29/08/2012
sp_UserOfflineSmall Offline

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>";
    
?>

30/08/2012
20:23
Avatar
ananthvk
India
New Member
Members
Forum Posts: 2
Member Since:
30/08/2012
sp_UserOfflineSmall Offline

Try changing this stmt echo "<?xml version='1.0' encoding='utf-8'?$etn";  to echo "<?xml version='1.0' encoding='utf-8'?$et \n"; 

Regards,rnVijay

Forum Timezone: Europe/Sofia

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.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information