Franky
|
|
« on: January 26, 2021, 08:07:32 PM » |
|
Hi Sir,
I'm using editable datagrid extension, having a datagrid which data come from database. However I need to pass parameter(let say userID) to the page so that the datagrid will show different set of data based on login id.
May I know any example to achieve this?
front end code: dg.edatagrid({ //title:'DataGrid - DetailView', width:'auto', height:'auto', remoteSort:false, //singleSelect:true, nowrap:false, fitColumns:true, striped:true, pagination:true, multiSort:true, url:'php/get_coo_data.php', columns:[[ {field:'item',title:'Item',width:40,sortable:true}, {field:'desc1',title:'Desciption',width:100,sortable:true}, {field:'prod_type',title:'Product Type',width:60,align:'center',sortable:true} ]] })
backend code: require_once('config.php'); userID = POST['userID'];
$sql = "SELECT * FROM item WHERE user_id = userID ";
$result = mysqli_query($sql);
$data = array();
while($row = mysqli_fetch_assoc($result)){ $data[] = $row; }
echo json_encode($data);
Thanks.
|