Hi, I try to update a table through a list with checkboxes , but still this error message appear:"SQLSTATE[HY093]: Invalid parameter number: parameter was not defined"
this my source code:

the script checkbox.html

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <link rel="shortcut icon" type="image/ico" href="http://www.datatables.net/favicon.ico">
    <meta name="viewport" content="initial-scale=1.0, maximum-scale=2.0">

    <!-- jQuery -->
    <script src="../../../charisma-master/bower_components/jquery/jquery.min.js"></script>
    <script type="text/javascript" language="javascript" src="JQuery/jquery-1.11.3.min.js"></script> 
    <script type="text/javascript" language="javascript" src="JQuery/jquery-ui.js"></script> 
    <script type="text/javascript" language="javascript" src="DataTables-1.10.7/media/js/jquery.dataTables.min.js"></script>
    <script type="text/javascript" language="javascript" src="DataTables-1.10.7/extensions/TableTools/js/dataTables.tableTools.min.js"></script>
    <script type="text/javascript" language="javascript" src="../../js/dataTables.editor.js"></script> 
    <script type="text/javascript" language="javascript" src="../resources/syntax/shCore.js"></script>

    <script type="text/javascript" language="javascript" class="init">

var editor; // use a global for the submit and return data rendering in the examples

$(document).ready(function() {
    editor = new $.fn.dataTable.Editor( {
        "ajax": "../php/checkbox.php",
        "table": "#example",
        "fields": [ {
                label:     "chauffeur:",
                name:      "chauffeur",
                type:      "checkbox",
                separator: "|",
                options:   [
                    { label: '', value: 1 }
                ]
            }, {
                label: "nom:",
                name:  "nom"
            }, {
                label: "prénom",
                name:  "prénom"
            }, {
                label: "grade:",
                name:  "grade"
            }
        ]
    } );

    $('#example').dataTable( {
        dom: "Tfrtip",
        ajax: "../php/checkbox.php",
        columns: [
            { data: "nom" },
            { data: "prénom" },
            { data: "grade" },

            {
                data:   "chauffeur",
                render: function ( data, type, row ) {
                    if ( type === 'display' ) {
                        return '<input type="checkbox" class="editor-active">';
                    }
                    return data;
                },
                className: "dt-body-center"
            }
        ],
        tableTools: {
            sRowSelect: "os",
            aButtons: [

                { sExtends: "editor_edit",   editor: editor }

            ],
            sRowSelector: 'td:not(:last-child)' // no row selection on last column
        },
        rowCallback: function ( row, data ) {
            // Set the checked state of the checkbox in the table
            $('input.editor-active', row).prop( 'checked', data.chauffeur == 1 );
        }
    } );

    $('#example').on( 'change', 'input.editor-active', function () {
        editor
            .edit( $(this).closest('tr'), false )
            .set( 'chauffeur', $(this).prop( 'checked' ) ? 1 : 0 )
            .submit();
    } );
} );



    </script>
</head>

<body background="armee-nationale.jpg" class="dt-example">




    <div class="container">
        <section>



            <table cellpadding="0" cellspacing="0" border="0" class="display" id="example" width="100%">
                <thead>
                    <tr>
                        <th>&#1575;&#1604;&#1575;&#1587;&#1605;</th>
                        <th>&#1575;&#1604;&#1604;&#1602;&#1576;</th>
                        <th>&#1575;&#1604;&#1585;&#1578;&#1576;&#1577;</th>

                        <th>&#1587;&#1575;&#1574;&#1602;</th>
                    </tr>
                </thead>
            </table>



        </section>
    </div>




<!-- external javascript -->

<script src="../../../charisma-master/bower_components/bootstrap/dist/js/bootstrap.min.js"></script>


<!-- select or dropdown enhancer -->
<script src="../../../bower_components/chosen/chosen.jquery.min.js"></script> 



</body>
</html>

checkbox.php

<?php

/*
 * Example PHP implementation used for the checkbox.html example
 */

// DataTables PHP library
include( "../../php/DataTables.php" );

// Alias Editor classes so they are easy to use
use
    DataTables\Editor,
    DataTables\Editor\Field,
    DataTables\Editor\Format,
    DataTables\Editor\Join,
    DataTables\Editor\Upload,
    DataTables\Editor\Validate;

// Build our Editor instance and process the data coming from _POST
Editor::inst( $db, 'listeservicelog' )
    ->fields(
        Field::inst( 'nom' ),
        Field::inst( 'prénom' ),
        Field::inst( 'grade' ),
                Field::inst( 'chauffeur' )
            ->setFormatter( function ( $val, $data, $opts ) {
                return ! $val ? 0 : 1;
            } )
    )
    ->process( $_POST )
    ->json();

I hope someone can help me solve the problem, thanks

Have you solve it? I got the same problem, this is due to non english colunm name

victor@ecotag.hk

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.