Edite/Delete/Add a row with MYSQL

Edite/Delete/Add a row with MYSQL

RyliatronRyliatron Posts: 5Questions: 0Answers: 0
edited September 2012 in Plug-ins
Hello guys,

I using this example; http://datatables.net/blog/Inline_editing

And i want to when i save this row, this system need to save my database. How can i do this? Sorry for bad english, i trying to learn :)

Replies

  • RyliatronRyliatron Posts: 5Questions: 0Answers: 0
    Im waiting to help..

    [code]
    function editRow ( oTable, nRow )
    {
    var aData = oTable.fnGetData(nRow);
    var jqTds = $('>td', nRow);
    jqTds[0].innerHTML = '';
    jqTds[1].innerHTML = '';
    jqTds[2].innerHTML = '';
    jqTds[3].innerHTML = '';
    jqTds[4].innerHTML = '';
    [/code]

    There is aData[0] etc. giving NULL value.
  • allanallan Posts: 63,395Questions: 1Answers: 10,451 Site admin
    You need to create a script on the server-side that will accept the data that is being set to the server and then act upon that data - for example create an INSERT query if creating a new row. How exactly that is done is under your control - the server-side environment is yours (is it PHP, .NET, Ruby, something else?).

    It is worth pointing out that Editor for DataTables ( http://editor.datatables.net ) has a full PHP server-side implementation with MySQL support, so you might want to consider that as a fast track option to get going.

    Allan
  • RyliatronRyliatron Posts: 5Questions: 0Answers: 0
    Hello Alan,

    Im crating a script yes. I see editor but when trial complete i dont have 65$ i must done edit.

    Im tryed for example, i write a php function.

    [code]
    function ekle($bolgeid,$sehirid,$firma,$tel,$web,$adres)
    {
    $sql="INSERT INTO `resbayipanel`.`veriler` (`id` ,`bolgeid` ,`sehirid` ,`firma` ,`adres`,`web`,`tel`) VALUES (NULL , '$bolgeid', '$sehirid', '$firma', '$adres', '$web', '$tel');";
    $result=mysql_query($sql);
    //echo $sql;
    }
    if($_GET['do'] == 'insert' )
    {
    ekle($_GET['bolgeid'],$_GET['sehirid'], $_GET['firma'], $_GET['adres'], $_GET['web'], $_GET['tel']);
    }?>
    [/code]

    Its working this link:
    [code]administrator.php?do=insert&bolgeid=1&sehirid=1&firma=OTOEKLENEN&adres=ASD&tel=3234&web=asd.com[/code]

    When added a new row, i want to get datas and write on this link:
    [code]
    function editRow ( oTable, nRow )
    {
    var aData = oTable.fnGetData(nRow);
    var jqTds = $('>td', nRow);
    jqTds[0].innerHTML = '';
    jqTds[1].innerHTML = '';
    jqTds[2].innerHTML = '';
    jqTds[3].innerHTML = '';
    jqTds[4].innerHTML = '';
    jqTds[5].innerHTML = '';
    jqTds[6].innerHTML = 'Kaydet';
    $.ajax({
    url: "administrator.php?do=insert&bolgeid=1&sehirid=1&firma="+aData[2]+aData[3]+aData[4]+aData[1]+"&adres=ASD&tel=tel&web=asd.com",
    context: document.body
    })
    }
    [/code]

    But ONLY Edit is working this link (first add and click edit, save it => its working)
  • RyliatronRyliatron Posts: 5Questions: 0Answers: 0
    Waiting a help :)
This discussion has been closed.