Title: calling php OOP method that retuns a JSON Post by: nbasicx on September 14, 2012, 01:23:48 AM I am try to use the example given in "Build CRUD Application with jQuery EasyUI", but this time round I have a PHP OOP function called get_data inside get_users.php i.e:
Class Users{ public function get_data() { $rs = mysql_query("select * from users"); $items = array(); while($row = mysql_fetch_object($rs)){ array_push($items, $row); } $result["rows"] = $items; echo json_encode($result); } } How do I specify the function the url section of the table tag in index.html i.e <table id="dg" title="My Users" class="easyui-datagrid" style="width:700px;height:250px" url="get_users.php?get_data" toolbar="#toolbar" pagination="true" rownumbers="true" fitColumns="true" singleSelect="true"> Since if I put the way I have done above it's not working? Title: Re: calling php OOP method that retuns a JSON Post by: baxter on September 14, 2012, 11:16:26 AM try this:
Code: Class Users{ When you will have a json string directly from mysql use CONCAT: Code: SELECT CONCAT('[',GROUP_CONCAT(CONCAT('{name:',USER.name,''),CONCAT(',email:',USER.email,'}')),']') FROM users WHERE STATUS = 'active' ORDER BY created ASC |