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_Related Related Topics sp_TopicIcon
Search Problem
16/05/2010
02:08
Avatar
Diego89
Member
Members
Forum Posts: 3
Member Since:
16/05/2010
sp_UserOfflineSmall Offline

Hi everybody!

Well i just got a search problem and i hope someone can help me.

This is my code:

Html Code:

<table id="list"></table>
<div id="pager"></div>

JS Code:

 

jQuery(document).ready(function(){
  jQuery("#list").jqGrid({
    url:'ERP_Tabla.php',
    datatype: 'xml',
    mtype: 'GET',
    colNames:['ID Usuario','Usuario', 'Contrasena','Ultimo Ingreso'],
    colModel :[
      {name:'id_usuario', index:'id_usuario', width:150},
      {name:'usuario', index:'usuario', width:90},
      {name:'contrasena', index:'contrasena', width:150, align:'right'},
      {name:'ultimo_ingreso', index:'ultimo_ingreso', width:80, align:'right'},  
    ],
    pager: jQuery('#pager'),
    rowNum:10,
    rowList:[10,20,30],
    sortname: 'id_usuario',
    sortorder: 'desc',
    viewrecords: true,
    autowidth: true,
    caption: 'KND ERP'
  }).navGrid('#pager',{edit:false,add:false,del:false});
 
});

PHP Code:

<?php
//include the information needed for the connection to MySQL data base server.
// we store here username, database and password
include("Scripts/ERPD_Conexion.php");

$page = $_GET['page'];
 
$limit = $_GET['rows'];
 
$sidx = $_GET['sidx'];
 
$sord = $_GET['sord'];
 
if(!$sidx) $sidx =1;
 
// connect to the MySQL database server
$db = new MySQL();
 
$result = $db -> consulta("SELECT COUNT(*) AS count FROM usuario");
$row = $db -> fetch_array($result);
$count = $row['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;
 
if($start <0) $start = 0;
 
$SQL = "SELECT * FROM usuario ORDER BY $sidx $sord LIMIT $start , $limit";
$result = $db -> consulta( $SQL );
 

header("Content-type: text/xml;charset=utf-8");

$s = "<?xml version='1.0' encoding='utf-8'?>";
$s .=  "<rows>";
$s .= "<page>".$page."</page>";
$s .= "<total>".$total_pages."</total>";
$s .= "<records>".$count."</records>";
 
// be sure to put text data in CDATA
while($row = $db -> fetch_array($result)) {
    $s .= "<row id='". $row['id_usuario']."'>";            
    $s .= "<cell><![CDATA[". $row['id_usuario']. "]]></cell>";
    $s .= "<cell><![CDATA[". $row['usuario']. "]]></cell>";
    $s .= "<cell><![CDATA[". $row['contrasena']. "]]></cell>";
    $s .= "<cell><![CDATA[". $row['ultimo_ingreso']."]]></cell>";
    $s .= "</row>";
}
$s .= "</rows>";
 
echo $s;
?>

Now when i try to search some data, the JQGrid doesn't return me nothing  i tried everything, but i can't figure out which is the problem if someone could help me, i will be very happy.

PS: Excuse me, iif my english is very bad Frown Wink.

16/05/2010
03:31
Avatar
tim
Calgary Alberta Canada
Member
Members
Forum Posts: 61
Member Since:
04/11/2009
sp_UserOfflineSmall Offline

Using Firebug, go to the URL that is meant to return your data.

Is it returning data? How does the data look (good or malformed)?

tim

17/05/2010
03:12
Avatar
Diego89
Member
Members
Forum Posts: 3
Member Since:
16/05/2010
sp_UserOfflineSmall Offline

the Parameters are

and returns me:

i have 2 record, when i search some information returns me both.

maybe when i import the scripts is the problem, i don't know, this is how i import:

<link rel="stylesheet" type="text/css" media="screen" href="../styles/themes/redmond/jquery-ui-1.7.1.custom.css" />
<link rel="stylesheet" type="text/css" media="screen" href="../styles/themes/ui.jqgrid.css" />
<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="js/i18n/grid.locale-sp.js"></script>
<script type="text/javascript" src="js/jquery.jqGrid.min.js"></script>
<script type="text/javascript" src="../JS/jquery-ui-1.8.1.custom.min.js"></script>
17/05/2010
05:18
Avatar
tim
Calgary Alberta Canada
Member
Members
Forum Posts: 61
Member Since:
04/11/2009
sp_UserOfflineSmall Offline

Well, I'm a little confused.

Originally you said: "the JQGrid doesn't return me nothing". Now you're saying "when i search some information returns me both"?

At any rate,  from what I can see you have no filter in your SQL query:

SELECT * FROM usuario ORDER BY ....

tim

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

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