Problem to retreive data php mysql

Problem to retreive data php mysql

Jarod511Jarod511 Posts: 8Questions: 0Answers: 0
edited August 2011 in General
Hello,
I'm developping a php/mysql website. I found the DataTables jsQuery which is usefull to show data in my database. However, I've some problem to catch the "POST" data when I used the checkbox on several values which are on different pages. It catches only values on the first page not all. How can I resolved this problem ?

Here my code :

Form.php :

[code]

@import "media/css/demos.css";




var oTable;
var giRedraw = false;

$(document).ready(function() {
/* Add a click handler to the rows - this could be used as a callback */
$("#example tbody").click(function(event) {
$(oTable.fnSettings().aoData).each(function (){
$(this.nTr).removeClass('row_selected');
});
$(event.target.parentNode).addClass('row_selected');
});

/* Add a click handler for the delete row */
$('#delete').click( function() {
var anSelected = fnGetSelected( oTable );
var iRow = oTable.fnGetPosition( anSelected[0] );
oTable.fnDeleteRow( iRow );
} );

/* Init the table */
oTable = $('#example').dataTable( );
} );


/* Get the rows which are currently selected */
function fnGetSelected( oTableLocal )
{
var aReturn = new Array();
var aTrs = oTableLocal.fnGetNodes();

for ( var i=0 ; i


<?php
require_once "config.php";
$sqlRq = "Select cim, fnomen from morpho";

$result = mysql_query($sqlRq) or trigger_error(mysql_error(),E_USER_ERROR);
?>
<!--jsQuery table-->



#
CIMO3
FNOMEN




<?php while(list($cim,$fnomen)=mysql_fetch_row($result)){
?>

<?php
echo '';?>
<?php echo $cim ?>
<?php echo $fnomen?>



<?php } ?>


<!--end jsQuery script-->


[/code]

On my Stat.php webpage, I take the checked values, problem, values checked on several pages aren't send.

Stat.php :
[code]
foreach($_POST['admin'] as $categ){
echo "$categ
";
$sql = "select count(distinct id) as Nombre, annee, CIMO from export where CIMO like '".$categ."'
group by annee order by annee desc";
$result = mysql_query($sql) or die(mysql_error());

echo "

Nombre
annee
CIMO

";
while($row = mysql_fetch_array($result))
{
echo "";
echo "" . $row['Nombre'] . "";
echo "" . $row['annee'] . "";
echo "" . $row['CIMO'] . "";
echo "";
}
echo "";
}
[/code]

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Hi Jarod511,

    The trouble here is that DataTables will remove elements from the document's DOM that aren't needed. For example if you are on page 2 of a table then the TR elements (and thus all their child elements, including your checkboxes) for pages 1 and >=3 are not directly available.

    This example shows how that can be dealt with: http://datatables.net/release-datatables/examples/api/form.html

    Regards,
    Allan
This discussion has been closed.