I need a PHP function that generates a HTML table from the MySQL result set data.
Example Usage:
$pageData .= $tableHeaderBlock . generateTable ($result, $columnTitles, "MyTableName", true, "MyTableCallbackFunction") . $tableFooterBlock;
Signature:
function generateTable ($tableDataSet = null, $tableColumnNames = null, $tableWebName = "", $callback = false, $callbackFunctionName = "") {
$tableReturnData = "";
//
// Function code goes here
//
return $tableReturnData;
}
The parameters to be passed include:
- the data set in a MySQL result array
- the column names for the table in an associative array: MySQL column text = web table column name.
(E.G. pcode = 'Post Code, addr1 = 'Address Line 1'')
- a table identifier string to be used in the HTML/JavaScript
- a flag=true to indicate if there is a function associated with the table, to be called when the user clicks on a row, or flag=false if no function to be called and no link to the row is provided.
- an optional parameter containing the PHP script/function name to be called with the table name and row identifier.
The HTML and/or JavaScript should allow users to re-sort the table on any column without referring to the server.
The PHP function returns a string containing the HTML to be included in the page sent to the browser. If the column titles are present but there is no data, then the table header row is generated and one blank row of data. If the data set is empty and the column titles are empty, an empty string should be returned.
When generating each data row of the table, it must be generated in conjunction with a row identifier if a callback is to be used. If a user clicks on a row the request is made to the callback function with the table name and row identifier parameters.
Hi Good day
I can develop this PHP function for you. Please look at my profile. You can understand my skill set. Looking forward to hear from you.
Thanks
Rinsad
Hello,
I am a very experienced PHP, Javascript, MySQL developer. This is a very simple task and I am confident that it will be accomplished within the required time-line. I will be honoured to work for you. Feel free to inbox me for more details.
Dear Sir,
I can do this for you using jQuery DataTables, data from PHP can be retrieved with ajax and then populate the table, DataTables are very Good because they offer, sorting, search, pagination facility without referring again to server.
Waiting for your reply.
Thank You!