use $_GET variable on Editor::inst( $db, $sql_table, 'ID' )

use $_GET variable on Editor::inst( $db, $sql_table, 'ID' )

fez226fez226 Posts: 18Questions: 1Answers: 0

Hello gurus, i need some help:

I have a variable on my URL call 'table' how i can passes to the local variable $sql_table for using on

Editor::inst( $db, $sql_table, 'ID' )

i try with: $sql_table = $_GET['table']; bus doesnt work: it bring me this error:

DataTables warning: table id=mant_dm - Invalid JSON response. For more information about this error, please see http://datatables.net/tn/1

how i can use $_GET??

my code:

<?php

// DataTables PHP library and database connection
include( "lib/DataTables.php" );
// Alias Editor classes so they are easy to use
use
DataTables\Editor,
DataTables\Editor\Field,
DataTables\Editor\Format,
DataTables\Editor\Mjoin,
DataTables\Editor\Options,
DataTables\Editor\Upload,
DataTables\Editor\Validate,
DataTables\Editor\ValidateOptions;

//$sql_tabla = $_GET['table'];
//$sql_tabla = 'test_table';
$sql_tabla = $db->quote( $_GET['table']);

Editor::inst( $db, $sql_tabla, 'ID' )
->fields(
Field::inst( 'Field1' ),
Field::inst( 'Field2' )
)
->process( $_POST )
->json();

Replies

This discussion has been closed.