Need Help: Editable Validated Datatable and MySQL

Need Help: Editable Validated Datatable and MySQL

metzmetz Posts: 2Questions: 0Answers: 0
edited November 2012 in DataTables 1.9
Hi I'm Metz, totally new to DataTables and i am semi-good in English.
Please help me to understand what to do to achieve a editable Datatable.
I hope this is the right Category - I am using the latest version of datatbles.

I'd like to add a Validation for new entries and hints for Users Inputfields.
When everything is correct, data should be saved in MySQL and current DataTable refreshes by changes.
I read some articles in this forum about it and looked for videotutorials in the web.
So I made this datatable.php, but I dont actually know what part of code could initialize an editable datatable.
I am running this code local with the software-distribution xampp.

Please show me as simple and specific to my code how I could edite, add, delete data.
I read something about a makeEditable-Function, but how do i use this?
[code]<?php
//Verbindungsaufbau mit MySQL Datenbank: Bisher noch Standardwerte
$con = mysql_connect("localhost", "root", "");
if (!$con) {
die("Error: " . mysql_error());
}
//Auswahl der Datenbank 'sample' und deren Tabelle 'referenz'
mysql_select_db("test", $con);
$result = mysql_query("SELECT * FROM referenz");
?>
<!DOCTYPE html>


DataTables

<!-- Einbindung externer Dateien bzw JavaScript-Bibliotheken und Cascading Style Sheet -Vorlagen -->



@import "jslib/DataTables-1.9.4/media/css/demo_table_jui.css";
@import "jslib/jquery-ui-1.9.1.custom/css/smoothness/jquery-ui-1.9.1.custom.css";


*{
font-family: arial;
}

<!-- Einrichtung des DataTables-Plugins
Pagination = Seitennummerierung mit Seitenzahlen
Tabellensortierung: Anfangsspalte initialisiert mit 'aufsteigend sortieren'
-->

$(document).ready(function(){
$('#datatables').dataTable({
"sPaginationType":"full_numbers",
"aaSorting":[[0, "asc"]],
"bJQueryUI":true
});
});
<!-- Einrichtung des Selektierens einzelner Reihen. Highlighting Rows -->
var oTable;
$(document).ready(function() {
/* Add a click handler to the rows - this could be used as a callback */
$("#datatables tbody tr").click( function( e ) {
if ( $(this).hasClass('row_selected') ) {
$(this).removeClass('row_selected');
}
else {
oTable.$('tr.row_selected').removeClass('row_selected');
$(this).addClass('row_selected');
}
});

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

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

/* Get the rows which are currently selected */
function fnGetSelected( oTableLocal )
{
return oTableLocal.$('tr.row_selected');
}







ID
Jahr
Autoren
Land
Titel
Format
Herausgeber
ISBN
Auflage
Kommentar
BenutzerID



<?php
while ($row = mysql_fetch_array($result)) {
?>

<?=$row['ID']?>
<?=$row['Jahr']?>
<?=$row['Autoren']?>
<?=$row['Land']?>
<?=$row['Titel']?>
<?=$row['Format']?>
<?=$row['Herausgeber']?>
<?=$row['ISBN']?>
<?=$row['Auflage']?>
<?=$row['Kommentar']?>
<?=$row['BenutzerID']?>

<?php
}
?>




[/code]
Soryy for my bad english.
(video-tutorial: youtube.com/watch?v=8MiakZ_sbgM
You can find the code on http://www.sharemycode.com/item/view/95/jquery-datatables-plugin-example )
This discussion has been closed.