unable to access data from url for mysql query

unable to access data from url for mysql query

James PayneJames Payne Posts: 15Questions: 0Answers: 0
edited February 2011 in General
Hello,

I'm using server side processing and am using allan's fabulous mysql query to access my db.

I need to get a parameter from the url I have set to restrict the results rather than get all results from a table.

My url looks like this - [code]view_clients.php?type=search_leads&leads=L[/code]

Here is the js code to implement the table - [code]$(document).ready(function() {
var client_lead = $.url.param("leads"); // returns 2
TableToolsInit.sSwfPath = "../library/swf/ZeroClipboard.swf";
$('#view_clients_if_leads').dataTable({
"sDom": 'rT=<"clear"><"H"lfivp>t<"F"ip>' ,
"bJQueryUI": true,
'bProcessing':true,
"bServerSide":true,
"bSort":true,
"sPaginationType": "full_numbers",
"sAjaxSource": "includes/datatable_form_parsers/view_clients_if_leads_parse.php?leads="+client_lead
}
});
});[/code]

here is the mysql query page [code]
$client_lead = $_GET['leads'];

$aColumns = array( 'contacts_id','companyname','clienttype','businesstype','sales_contact' );

$sIndexColumn = "contacts_id";

$sTable = "contacts";

$gaSql['user'] = "****";
$gaSql['password'] = "*****";
$gaSql['db'] = "****";
$gaSql['server'] = "localhost";

$gaSql['link'] = mysql_pconnect( $gaSql['server'], $gaSql['user'], $gaSql['password'] ) or
die( 'Could not open connection to server' );

mysql_select_db( $gaSql['db'], $gaSql['link'] ) or
die( 'Could not select database '. $gaSql['db'] );

$sLimit = "";
if ( isset( $_GET['iDisplayStart'] ) && $_GET['iDisplayLength'] != '-1' )
{
$sLimit = "LIMIT ".mysql_real_escape_string( $_GET['iDisplayStart'] ).", ".
mysql_real_escape_string( $_GET['iDisplayLength'] );
}

if ( isset( $_GET['iSortCol_0'] ) )
{
$sOrder = "ORDER BY ";
for ( $i=0 ; $i $iFilteredTotal,
"aaData" => array()
);

while ( $aRow = mysql_fetch_array( $rResult ) )
{
$row = array();
for ( $i=0 ; $i[/code]


If I change the variable $client_lead in the WHERE part for 'L' the code works fine but it won't otherwise.

Does anyone have any ideas where to start debugging?

Thanks,

James

Replies

This discussion has been closed.