Passing cell content to dataprocessor

Hi,

I’m creating 2 grid :



grid1 is populated with data from Mysql database with dataprocessor method.

grid2 should be populated with data when onRowSelect event comes from the first grid and should

load data from mysql database with data filtered by a value in the first grid.



see the code:






















and the function is:



function viewtimesheet(rowID,celInd){

mygrid2.clearAll();//clear all rows if was loaded before

mygrid2.loadXML(“includes/php/getdata1.php”);    //Data Processor

}



the php server code is :



<?php

//include db connection settings

//change this setting according to your environment

require_once(“config.php”);



//include XML Header (as response will be in xml format)

header(“Content-type: text/xml”);

//encoding may be different in your case

echo(’<?xml version="1.0" encoding="iso-8859-1"?>’);

//start output of data

echo ‘’;



//output data from DB as XML

$sql = “SELECT hs.loc_code, hs.loc_city, b.employee_id, b.emp_lastname, b.emp_firstname, a.emp_number " .

        “FROM hs_hr_location hs " .

        “JOIN (hs_hr_emp_locations a " .

        “JOIN hs_hr_employee b " .

        “ON (a.emp_number=b.emp_number)) " .

        “ON (a.loc_code=hs.loc_code) " .

        “WHERE b.emp_status<>‘EST009’ AND b.emp_status<>‘EST011’ AND b.emp_status<>‘EST012’”;

$res = mysql_query ($sql);

    

if($res){

    while($row=mysql_fetch_array($res)){

        //create xml tag for grid’s row

        echo (”<row id=’”.$row[‘emp_number’].”’>”);

        print(””);

        print("");

        print("");

        print("");

        print("");

    }

}else{

//error occurs

    echo mysql_errno().": “.mysql_error().” at “.LINE.” line in “.FILE.” file
";

}

echo ‘’;

?>



At the moment i’m not able to pass a particular cell value when the row which belong is selected…

how can i do that in order to insert the value/variable in the WHERE clause of select?

Thank You very much,

on client side

function viewtimesheet(rowID,celInd){
mygrid2.clearAll();//clear all rows if was loaded before
mygrid2.loadXML(“includes/php/getdata1.php?filter=”+mygrid.cells(rowID,celInd).getValue()); //send cell value to the server

on server side

“WHERE b.emp_status<>‘EST009’ AND b.emp_status<>‘EST011’ AND b.emp_status<>‘EST012’”.
" AND some_filed like ‘".$_GET[“filter”]."’";

The code on server side seem to be not correct because my editor says syntax error:

i’ve replaced with:

“WHERE b.emp_status<>‘EST009’ AND b.emp_status<>‘EST011’ AND b.emp_status<>‘EST012’AND b.emp_firstname like’”.$_GET[“filter”];

but page bad xml…

Why?

Please try to add an extra whitespace after “like” instruction ( actually you can use any other filtering rule here )
<>'EST012’AND b.emp_firstname LIKE ‘".$_GET[“filter”]."’ "; //extra whitespace and closing quote