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
missing ) in parenthetical
10/11/2009
04:16
Avatar
phicarre
Member
Members
Forum Posts: 132
Member Since:
09/11/2009
sp_UserOfflineSmall Offline

Hi,

I copied from the wiki this example and adapted it.

- french language

- other mysql database

What could be wrong ?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="fr" xml:lang="fr">
<head>

<meta http-equiv="content-type" content="text/html; charset=ISO-8859-15" />
<title>My First Grid</title>
<script src="jGrid/js/jquery-1.3.2.min.js" type="text/javascript"></script>
<script type="text/javascript" src="jquery/jquery-ui-1.7.1.custom.min.js"></script>  
<link rel="Stylesheet"  href="jquery/theme/ui.all.css" type="text/css" />
<link rel="stylesheet" type="text/css" media="screen" href="jGrid/css/ui.jqgrid.css" />

<script src="jGrid/js/i18n/grid.locale-fr.js" type="text/javascript"></script>
<script src="jGrid/js/jquery.jqGrid.min.js" type="text/javascript"></script>
<script src="jGrid/src/grid.loader.js" type="text/javascript"></script>
<script type="text/javascript">
 jQuery(document).ready(function ()
 {
  jQuery("#list1").jqGrid({
     url:'testjgrid2.php',
     datatype: "json",
     mtype: 'GET',
     colNames:['Nom','Prénom', 'Sexe'],
     colModel:[
     {name:'id_resident',index:'id_resident', width:75},
     {name:'nom',index:'nom', width:100},
     {name:'sexe',index:'sexe', width:80, align:"right"},
     ],
     rowNum:10,
     autowidth: true,
     rowList:[10,20,30],
     pager: jQuery('#pager1'),
     sortname: 'id_resident',
     viewrecords: true,
     sortorder: "desc",
     caption:"Mon premier exemple",
    
  }).navGrid('#pager1',{edit:false,add:false,del:false});
 })
</script>
</head>
<body>
<table id="list1"></table>
<div id="pager1" class="scroll" style="text-align:center;"></div>
</body>
</html>

My php script:

<?php
   require_once('includes/common.php');
   require_once("debug.php"); 
   debug_application("testjgrid2");
   $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
   $connection = mysql_connect($serveur,$user,$password);
   $db = mysql_select_db($bdd, $connection);
   $result = mysql_query("SELECT COUNT(*) AS count FROM residents",$connection);
   $row = mysql_fetch_array($result);
   $count = $row['count'];
   print $count;
   if( $count > 0 && $limit > 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)
   if ($start<0) $start = 0;
  
   $SQL = "SELECT * FROM residents WHERE (ID_EMS ='1') ORDER BY Nom LIMIT $start , $limit";
  
   $result = mysql_query( $SQL,$connection ) or die("Couldn?t execute query.".mysql_error());
   $responce->page = $page;
   $responce->total = $total_pages;
   $responce->records = $count;
   $i=0;
   while($row = mysql_fetch_array($result)) {
       $responce->rows[$i]=$responce->rows[$i]['cell']=array($row['id_resident'],$row['nom'],$row['prenom'],$row['sexe']);
       $i++;
   }
   debug_application($responce);
   echo json_encode($responce);
?>

I have this error in firebug:

missing ) in parenthetical         grid.base.js line 59

10/11/2009
04:29
Avatar
Romyn
Member
Members
Forum Posts: 45
Member Since:
13/06/2009
sp_UserOfflineSmall Offline

Hi,

Lose the , at the end of the caption line.

caption:”Mon premier exemple”,

should be

caption:”Mon premier exemple”

That's the obvious one - don't know if there are more.

Regards

Romyn

10/11/2009
07:58
Avatar
phicarre
Member
Members
Forum Posts: 132
Member Since:
09/11/2009
sp_UserOfflineSmall Offline

Thank you.

Forget my question: there are too many errors Confused

Now I corrected them.

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
29 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