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
Could anyone point out what I am doing out here?
30/05/2009
12:13
Avatar
perpetual_dream
New Member
Members
Forum Posts: 1
Member Since:
30/05/2009
sp_UserOfflineSmall Offline

Hello,

It wasn't until yesterday that I have found this great Jquery plugin yet I can't get it running.

I have two pages: display_articleshtml.php (which contains the html code) and (display_articles2.php) which contains the php (database related code).

First, until now I have a problem understanding the parameters that are passed to the server(.php pages). Where do the page', 'sidx', 'sort','row' URL variables get passed?

After finally managing to return a valid xml document from display_articles2.php, still nothing is being displayed at display_articleshtml.php 

Could anyone kindly point out what I am doing wrong….

Here is my PHP (server side code)- display_articles2.php:

<?php
//this block is for paging/sorting and displaying the results
require_once ('../includes/config.inc.php');
$lang=return_lang();
require_once(BASE_URI.'languages/'.$lang.'.php'); 
?>
<? // Determine how many pages there are…
// get the requested page

if (isset($_REQUEST['page'])) {
$page = $_REQUEST['page'];
} else {
$page='1';
}
// get how many rows we want to have into the grid
// rowNum parameter in the grid
if (isset($_REQUEST['row'])) {
$limit = $_REQUEST['row'];
} else {
$limit='10';
}

if (isset($_REQUEST['sidx'])) {
$sidx = $_REQUEST['sidx'];
} else {
$sidx='1';
}

if (isset($_REQUEST['sort'])) {
$sord = $_REQUEST['sort'];
} else {
$sord='ASC';
}

// get index row - i.e. user click to sort
// at first time sortname parameter - after that the index from colModel

// if we not pass at first time index use the first column for the index
if(!$sidx) $sidx =1;

    $q2 = “SELECT COUNT(article_id) FROM articles”;
    $r2 = mysql_query($q2,$dbc);

    $row = mysql_fetch_array($r2);
    $count = $row[0];

//calculation of total pages for the query
if( $count >0 ) {
    $total_pages = ceil($count/$limit);
} else {
    $total_pages = 0;
}

// if for some reasons the requested page is greater than the total
// set the requested page to total page
if ($page > $total_pages) $page=$total_pages;

// calculate the starting position of the rows
$start = $limit*$page - $limit; // do not put $limit*($page - 1)
// if for some reasons start position is negative set it to 0
// typical case is that the user type 0 for the requested page
if($start <0) $start = 0;
// Determine the sorting order:
// Make the query:
$q = “SELECT articles.article_id, articles_categories.name as category_name, DATE_FORMAT(articles.date_added, '%d %M, %Y') AS date_added, articles.title, articles.description, articles.privacy,articles.sticky FROM articles INNER JOIN articles_categories ON articles.category_id=articles_categories.category_id   ORDER BY $sidx $sord LIMIT $start , $limit”;
$r = mysql_query($q,$dbc); // Run the query.
// Table header:
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″);
}
echo “<?xml version='1.0' encoding='utf-8'?>”;
echo “<rows>”;
echo “<page>”.$page.”</page>”;
echo “<total>”.$total_pages.”</total>”;
echo “<records>”.$count.”</records>”;
while ($row = mysql_fetch_array($r, MYSQL_ASSOC)) {
if ($row['sticky']==YES) {
$stickyimage=”thumb_up.gif”;
} else {
$stickyimage=”thumb_down.gif”;
}

if ($row['privacy']==EVERYBODY) {
$privacyimage=”public-icon.png”;
} elseif ($row['privacy']==REGISTERED) {
$privacyimage=”user-icon.png”;
} else {
$privacyimage=”private-icon.png”;
}

echo “<row id='”. $row['article_id'] .”'>”;           
            echo “<cell>”. $row['category_name'].”</cell>”;
            //echo “<cell>”. $row['article_id'] .”</cell>”;
            echo “<cell>”. '<img width=”16″ height=”16″ border=”0″ src=”../images/icon_delete.gif”/>'.”</cell>”;
            echo “<cell>”. '<img width=”16″ height=”16″ border=”0″ src=”../images/icon_delete.gif”/>'.”</cell>”;
            echo “<cell>”. '<img border=”0″ src=”../images/'.$stickyimage.'”/>'.”</cell>”;
            echo “<cell>”. '<img border=”0″ src=”../images/'.$privacyimage.'”/>'.”</cell>”;
            echo “<cell>”. formatdate($row['date_added']).”</cell>”;
           
            echo “<cell>”. $row['title'].”</cell>”;
            echo “</row>”;
}
echo “</rows>”;

   

?>

Thanks

31/05/2009
11:29
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello,

So my question is: What is the problem? Can you see the response from the server (using FireBug) If you can not see the response then this is not a jqGrid problem at all.

Best Regards

Tony

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
64 Guest(s)

Currently Browsing this Page:
1 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