PHP Form with DataTables Enhancement
PHP Form with DataTables Enhancement
Hi,
First i wanted to thank the team for developping such a great tool.
Sorry for long post but i want to be as clear as possible. Here is my problem :I am doing an interface for a user to set criterias through a POST FORM (html+php) and run the slq search into a huge database (millions of rows), then show the results on a table.
I wanted to include the DataTables enhancement, mainly for pagination and sorting.
1) I tried at first to just include datatable into my normal table, here is a sample of the table i used
[code]
Order
Type
Manager
Plaque
DR
[......]
Error
<?php
while ($row = mysql_fetch_array($requestA))
{
echo '';
echo '';
echo '';
echo $row['main']; echo '
';
echo $row['order'];
echo '';
echo '';
echo $row['neman']; echo '
';
echo $row['nearea'];echo '
';
[.... rest of table ...]
echo '';
echo $row['errormessage'];
echo '';
echo '';
echo '';
}
?>
[/code]
Initialization :
[code]
$(document).ready(function() {
$('#datatables').dataTable();
} );
[/code]
Adding simply id="datatables" in my does not work because it just detect one entry (Showing 1 to 1 of 1 entries) and therefore can't sort nor paginate.
2) I looked for the server side feature. I was at first not able to make it work because i did not know where i could link my $_POST variables with the $sWhere in server_processing.php
So i looked for a step by step tutorial which led me to : http://www.packtpub.com/article/data-tables-datatables-plugin-jquery-1.3-with-php
It worked pretty well but only work to display a complete database...it can't be mixed with $_POST variables that i set.
I am pretty sure that this is possible but i can't find any source (examples) to understand how this work nor tutorials for my problem.
Thank you very mych for any help you could provide me !
First i wanted to thank the team for developping such a great tool.
Sorry for long post but i want to be as clear as possible. Here is my problem :I am doing an interface for a user to set criterias through a POST FORM (html+php) and run the slq search into a huge database (millions of rows), then show the results on a table.
I wanted to include the DataTables enhancement, mainly for pagination and sorting.
1) I tried at first to just include datatable into my normal table, here is a sample of the table i used
[code]
Order
Type
Manager
Plaque
DR
[......]
Error
<?php
while ($row = mysql_fetch_array($requestA))
{
echo '';
echo '';
echo '';
echo $row['main']; echo '
';
echo $row['order'];
echo '';
echo '';
echo $row['neman']; echo '
';
echo $row['nearea'];echo '
';
[.... rest of table ...]
echo '';
echo $row['errormessage'];
echo '';
echo '';
echo '';
}
?>
[/code]
Initialization :
[code]
$(document).ready(function() {
$('#datatables').dataTable();
} );
[/code]
Adding simply id="datatables" in my does not work because it just detect one entry (Showing 1 to 1 of 1 entries) and therefore can't sort nor paginate.
2) I looked for the server side feature. I was at first not able to make it work because i did not know where i could link my $_POST variables with the $sWhere in server_processing.php
So i looked for a step by step tutorial which led me to : http://www.packtpub.com/article/data-tables-datatables-plugin-jquery-1.3-with-php
It worked pretty well but only work to display a complete database...it can't be mixed with $_POST variables that i set.
I am pretty sure that this is possible but i can't find any source (examples) to understand how this work nor tutorials for my problem.
Thank you very mych for any help you could provide me !
This discussion has been closed.
Replies
Put the before the while loop and the after it and see what that does.
Steph
Also...good eyes!
Flavio.