Advertisement
Guest User

sqlite sample phpgrid

a guest
Nov 2nd, 2015
510
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.80 KB | None | 0 0
  1. <?php
  2. /**
  3. * PHP Grid Component
  4. *
  5. * @author Abu Ghufran <gridphp@gmail.com> - http://www.phpgrid.org
  6. * @version 1.5.2
  7. * @license: see license.txt included in package
  8. */
  9.  
  10. /**
  11. * To support non-mysql databases (even mysql), see adodb lib documentation below:
  12. * http://phplens.com/lens/adodb/docs-adodb.htm#connect_ex
  13. * http://phplens.com/lens/adodb/docs-adodb.htm#drivers
  14. */
  15. $db_conf = array();
  16. $db_conf["type"] = "pdo"; // mysql,oci8(for oracle),mssql,postgres,sybase
  17. $db_conf["server"] = "sqlite:../../sampledb/northwind.sqlite";
  18. $db_conf["user"] = "";
  19. $db_conf["password"] = "";
  20. $db_conf["database"] = "";
  21.  
  22. include("../../lib/inc/jqgrid_dist.php");
  23. $g = new jqgrid($db_conf);
  24.  
  25. // set few params
  26. $grid["caption"] = "Sample Grid";
  27. $grid["autowidth"] = true;
  28. $grid["rowNum"] = 50;
  29. $g->set_options($grid);
  30.  
  31. // set database table for CRUD operations
  32. $g->table = "employees";
  33.  
  34. $g->set_columns($cols);
  35.  
  36. // render grid
  37. $out = $g->render("list1");
  38. ?>
  39. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
  40. <html>
  41. <head>
  42. <link rel="stylesheet" type="text/css" media="screen" href="../../lib/js/themes/redmond/jquery-ui.custom.css"></link>
  43. <link rel="stylesheet" type="text/css" media="screen" href="../../lib/js/jqgrid/css/ui.jqgrid.css"></link>
  44.  
  45. <script src="../../lib/js/jquery.min.js" type="text/javascript"></script>
  46. <script src="../../lib/js/jqgrid/js/i18n/grid.locale-en.js" type="text/javascript"></script>
  47. <script src="../../lib/js/jqgrid/js/jquery.jqGrid.min.js" type="text/javascript"></script>
  48. <script src="../../lib/js/themes/jquery-ui.custom.min.js" type="text/javascript"></script>
  49. </head>
  50. <body>
  51. You must have SQLite extension installed for this demo.
  52. <div style="margin:10px">
  53. <?php echo $out?>
  54. </div>
  55. </body>
  56. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement