Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6769527
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:12:14+00:00 2026-05-26T15:12:14+00:00

i ve post this question in programmers.stackexchange.com also and they told me that it

  • 0

i ve post this question in programmers.stackexchange.com also and they told me that it was off topic there. So..let me tell you the story.

Yesterday , after reading the documentation (www.trirand.com/jqgridwiki/doku.php) of jqgrid i created a simple table that gets data from a xml file returned by a php file.

In particular here is the code.

index.html
and example.php

As an example I use this one,
but the problem is that I cannot make the select search method work in this way. I thought to use dataUrl in editoptions but in the wiki says that this works only with HTML files.

I can’t imagine a way to manipulate the data of the xml file to make the dropdown menu work.

How to make it work?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T15:12:15+00:00Added an answer on May 26, 2026 at 3:12 pm

    Finally i solve this problem with the help of this code:

    <?php
    $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;
    
    //array to translate the search type
    $ops = array(
        'eq'=>'=', //equal
        'ne'=>'<>',//not equal
        'lt'=>'<', //less than
        'le'=>'<=',//less than or equal
        'gt'=>'>', //greater than
        'ge'=>'>=',//greater than or equal
        'bw'=>'LIKE', //begins with
        'bn'=>'NOT LIKE', //doesn't begin with
        'in'=>'LIKE', //is in
        'ni'=>'NOT LIKE', //is not in
        'ew'=>'LIKE', //ends with
        'en'=>'NOT LIKE', //doesn't end with
        'cn'=>'LIKE', // contains
        'nc'=>'NOT LIKE'  //doesn't contain
    );
    function getWhereClause($col, $oper, $val){
        global $ops;
        if($oper == 'bw' || $oper == 'bn') $val .= '%';
        if($oper == 'ew' || $oper == 'en' ) $val = '%'.$val;
        if($oper == 'cn' || $oper == 'nc' || $oper == 'in' || $oper == 'ni') $val = '%'.$val.'%';
        return " WHERE $col {$ops[$oper]} '$val' ";
    }
    $where = ""; //if there is no search request sent by jqgrid, $where should be empty
    $searchField = isset($_GET['searchField']) ? $_GET['searchField'] : false;
    $searchOper = isset($_GET['searchOper']) ? $_GET['searchOper']: false;
    $searchString = isset($_GET['searchString']) ? $_GET['searchString'] : false;
    if ($_GET['_search'] == 'true') {
        $where = getWhereClause($searchField,$searchOper,$searchString);
    }
    
    // connect to the database
    $dbhost = "host_address";
    $dbuser = "db_user";
    $dbpassword = "db_pass";
    $database = "db_name";
    $tablename
    $db = mysql_connect($dbhost, $dbuser, $dbpassword)
    or die("Connection Error: " . mysql_error());
    
    mysql_select_db($database) or die("Error conecting to db.");
    mysql_set_charset('utf8',$database);
    mysql_query("SET NAMES 'utf8'");
    $result = mysql_query("SELECT COUNT(*) AS count FROM $tablename");
    $row = mysql_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 field1, field2, field3, field4, field5 FROM $tablename "
    .$where." ORDER BY $sidx $sord LIMIT $start , $limit";
    $result = mysql_query( $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'?$et\n";
    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 = mysql_fetch_array($result,MYSQL_ASSOC)) {
        echo "<row id='". $row[field1]."'>";
        echo "<cell>". $row[field1]."</cell>";
        echo "<cell>". $row[field2]."</cell>";
        echo "<cell><![CDATA[". $row[field3]."]]></cell>";
        echo "<cell>". $row[field4]."</cell>";
        echo "<cell>". $row[field5]."</cell>";
        echo "</row>";
    }
    echo "</rows>";
    ?>
    

    Source

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I hope this question is not too off-topic, if it is this post can
( I don't know whether should I also post this question to ServerFault, since
I was reading this thread/post: https://stackoverflow.com/questions/262298/windows-c-ui-technology and am also wondering about a non .NET
I am hoping that there is someone that can help me with this question.
This is my first time here so I hope I post this question at
This post asks this question but doesn't really give an answer, so I thought
I am not sure if I can post this sort of question (apologies in
In this question I asked how to POST to a php file form a
In this question @Jon skeet referenced this old blog post by the authority Chris
This question is related to a previous post of mine Here . Basically, I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.