webismymind / editablegrid-mysql-example

This example shows how to use EditableGrid with a MySQL database
MIT License
58 stars 38 forks source link

Tried Putting my Own Table #36

Open DeMzz opened 8 years ago

DeMzz commented 8 years ago

Hi i've tried putting my own table and it seems that it doesnt work :'( please help me

this is my loaddata.php

<?php

/*

/**

require_once('config.php');
require_once('EditableGrid.php');

/**

// Database connection $mysqli = mysqli_init(); $mysqli->options(MYSQLI_OPT_CONNECT_TIMEOUT, 5); $mysqli->real_connect($config['db_host'],$config['db_user'],$config['db_password'],$config['db_name']);

// create a new EditableGrid object $grid = new EditableGrid();

/*

$mydb_tablename = (isset($_GET['db_tablename'])) ? stripslashes($_GET['db_tablename']) : 'announcement';

$result = $mysqli->query('SELECT *, date_format(lastvisit, "%d/%m/%Y") as lastvisit FROM '.$mydb_tablename ); $mysqli->close();

// send data to the browser $grid->renderJSON($result);

4A0E commented 8 years ago

The issue is with the following line: $result = $mysqli->query('SELECT *, date_format(lastvisit, "%d/%m/%Y") as lastvisit FROM '.$mydb_tablename );

Remove (, date_format(lastvisit, "%d/%m/%Y") as lastvisit ) or add that column to your table.