How to pass variable js in command PHP SQL (DrillDown Row)
How to pass variable js in command PHP SQL (DrillDown Row)
excuse me for the generic topic, i will try to explain it best
i post the code:
here it create a second table in a DrillDown Row (Don'T read the comment, they personal comment;) )
[code]
$('#the_table td.control').live('click', function () {
var nTr = this.parentNode;
var i = $.inArray( nTr, anOpen );
alert(nTr);
alert (anOpen+'indice');
alert (i);
if ( i === -1 ) {
$('img', this).attr( 'src', sImageUrl+"details_close.png" );
var nDetailsRow = oTable.fnOpen( nTr, fnFormatDetails(oTable, nTr), 'details' );
$('div.innerDetails', nDetailsRow).slideDown();
/*METTE IL NODO CHE HA CHIAMATO LO SCRIPT NELL'ARRAY anOpen*/
anOpen.push( nTr );
oData=oTable.fnGetData( nTr );
variabile=oData[0];
//DENTRO .LIVE E L'IF MI CREO LA TABELLA
$('#the_table'+variabile).dataTable({
[.........................................]
})
[/code]
Here the Function called from fnOpen
[code]
function fnFormatDetails( oTable, nTr )
{
var oData = oTable.fnGetData( nTr );
var sOut =
''+
''+
'
'+
''+
''+
''+
' ID Movimento'+
' ID Magazzino '+
' Data'+
' Autore'+
'Entrate'+
'Uscite'+
'Prenotati'+
' '+
''+
''+
''+
'Loading data from server'+
''+
''+
''+
''+
' ID Movimento'+
' ID Magazzino '+
' Data'+
' Autore'+
'Entrate'+
'Uscite'+
'Prenotati'+
''+
''+
''+
'
'+
''+
''+
''+
''+
''+
''+
' Entrata
'+
' Uscita
'+
'Prenotati'+'<?php
echo "";
$result2 = mysql_query("SELECT DISTINCT `Giacenza` FROM `Magazzino`");
while($row = mysql_fetch_array($result2))
{
echo "".$row['Giacenza']."";
}
echo "
";
?>'+
''+
'';
return sOut;
};
[/code]
the problem is here
$result2 = mysql_query("SELECT DISTINCT `Giacenza` FROM `Magazzino`");
it shoud be $result2 = mysql_query("SELECT DISTINCT `Giacenza` FROM `Magazzino`WHERE ID=oData[0]");
p.s. oData[0]= Open Node ID
Naturally i don't pass oData[0] at the script php...
i post the code:
here it create a second table in a DrillDown Row (Don'T read the comment, they personal comment;) )
[code]
$('#the_table td.control').live('click', function () {
var nTr = this.parentNode;
var i = $.inArray( nTr, anOpen );
alert(nTr);
alert (anOpen+'indice');
alert (i);
if ( i === -1 ) {
$('img', this).attr( 'src', sImageUrl+"details_close.png" );
var nDetailsRow = oTable.fnOpen( nTr, fnFormatDetails(oTable, nTr), 'details' );
$('div.innerDetails', nDetailsRow).slideDown();
/*METTE IL NODO CHE HA CHIAMATO LO SCRIPT NELL'ARRAY anOpen*/
anOpen.push( nTr );
oData=oTable.fnGetData( nTr );
variabile=oData[0];
//DENTRO .LIVE E L'IF MI CREO LA TABELLA
$('#the_table'+variabile).dataTable({
[.........................................]
})
[/code]
Here the Function called from fnOpen
[code]
function fnFormatDetails( oTable, nTr )
{
var oData = oTable.fnGetData( nTr );
var sOut =
''+
''+
'
'+
''+
''+
''+
' ID Movimento'+
' ID Magazzino '+
' Data'+
' Autore'+
'Entrate'+
'Uscite'+
'Prenotati'+
' '+
''+
''+
''+
'Loading data from server'+
''+
''+
''+
''+
' ID Movimento'+
' ID Magazzino '+
' Data'+
' Autore'+
'Entrate'+
'Uscite'+
'Prenotati'+
''+
''+
''+
'
'+
''+
''+
''+
''+
''+
''+
' Entrata
'+
' Uscita
'+
'Prenotati'+'<?php
echo "";
$result2 = mysql_query("SELECT DISTINCT `Giacenza` FROM `Magazzino`");
while($row = mysql_fetch_array($result2))
{
echo "".$row['Giacenza']."";
}
echo "
";
?>'+
''+
'';
return sOut;
};
[/code]
the problem is here
$result2 = mysql_query("SELECT DISTINCT `Giacenza` FROM `Magazzino`");
it shoud be $result2 = mysql_query("SELECT DISTINCT `Giacenza` FROM `Magazzino`WHERE ID=oData[0]");
p.s. oData[0]= Open Node ID
Naturally i don't pass oData[0] at the script php...
This discussion has been closed.