server_processing.php
server_processing.php
eduardo12fox
Posts: 17Questions: 0Answers: 0
Ol
This discussion has been closed.
Replies
First I want to say I'm a fan of this script is great and expedited
a lot of my work. You have done well.
I'm a beginner in your script and am having a doubt. Forgive me if I already have
I tried to answer but eDo not found.
I need to know in detail how I filter my query because I tried to give a
include only the page that the script returns all rows in their headers I
was wondering how I move some variables to the
server_processing2.php
[code]
$aColumns = array( 'cod', 'lote', 'produto', 'fornecedor', 'qtd_entrada', 'qtd_atual', 'fracionado', 'preco_custo', 'preco_venda', 'qtd_fracionado_atual',
'validade' );
/* Indexed column (used for fast and accurate table cardinality) */
$sIndexColumn = "produto";
/* DB table to use */
$sTable = "relatoriogeral";
//$sTable = "produto WHERE validade between '2011-12-01' and '2011-12-31'"; -- CASO QUEIRA COM FILTRO --
/* Database connection information */
$gaSql['user'] = "root";
$gaSql['password'] = "";
$gaSql['db'] = "estoque";
$gaSql['server'] = "127.0.0.1";
[/code]
This is my setup I want to filter this query by the expiration date would therefore like
select cod, batch, product, supplier, qtd_entrada, qtd_atual, fractionated preco_custo, preco_venda, qtd_fracionado_atual, valid from relatoriogeral WHERE validity Between '2010-01-01 'and '2011-30-01 '
how I can send to server_processing.php?
[code]
$sWhere = "WHERE (";
[/code]
could become
[code]
$sWhere = "WHERE validity Between '2010-01-01 'and '2011-30-01 ' AND (";
[/code]
Allan
[code]
$(document).ready( function () {
var oTable = $('#example').dataTable( {
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "server_processing2.php",
"sDom": 'RCT<"clear">lfrtip',
"oTableTools": {
"sSwfPath": "media/swf/copy_cvs_xls_pdf.swf",
"aoColumnDefs": [
{ "bVisible": false, "aTargets": [ 1 ] }
]
},
"fnServerData": function ( sSource, aoData, fnCallback ) {
/* Add some extra data to the sender */
aoData.push( { "name": "2010-01-01", "value": "2012-12-12" } );
$.getJSON( sSource, aoData, function (json) {
/* Do whatever additional processing you want on the callback, then tell DataTables */
fnCallback(json)
} );
}
} );
} );
[/code]
and no server_processing.php
Idid so:
[code]
$sWhere = "";
if ( $_GET['sSearch'] != "" )
{
$sWhere = "WHERE ( validade between ' ??? ' and ' ??? ' ";
//$sWhere = "and ("; -- CASO QUEIRA COM FILTRO --
for ( $i=0 ; $i
[code]
aoData.push( { "name": "date_end", "value": "2012-12-12" } );
aoData.push( { "name": "date_start", "value": "2010-01-01" } );
[/code]
in your fnServerData. Otherwise you have a variable called 2010-01-01 with the value of 2012-12-12!
Then you can use $_REQUEST['date_end'] etc in your PHP.
Allan