3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php // set up DB $conn = mysql_connect("localhost", "root", "root"); mysql_select_db("catweb_database"); // set your db encoding -- for ascent chars (if required) mysql_query("SET NAMES 'utf8'"); // include and create object include("inc/jqgrid_dist.php"); session_start(); $id_user = $_SESSION['id_user']; $col = array(); $col["title"] = "Key"; $col["name"] = "id_cliente"; $col["sortable"] = false; $col["search"] = false; $col["editable"] = false; $col["hidden"] = true; $cols[] = $col; $col = array(); $col["title"] = "Id Utente"; $col["name"] = "IDUTENTE"; $col["sortable"] = false; // this column is not sortable $col["search"] = false; // this column is not searchable $col["editable"] = true; $col["editoptions"] = array("value"=>$id_user); $col["hidden"] = true; $cols[] = $col; $col = array(); $col["title"] = "Ragione Sociale"; $col["name"] = "ragione_sociale"; # $col["width"] = "300"; // not specifying width will expand to fill space $col["sortable"] = true; // this column is not sortable $col["search"] = true; // this column is not searchable $col["editrules"] = array("required"=>true); $col["editable"] = true; $cols[] = $col; $col = array(); $col["title"] = "Recapito"; $col["name"] = "recapito"; # $col["width"] = "300"; // not specifying width will expand to fill space $col["sortable"] = false; // this column is not sortable $col["search"] = false; // this column is not searchable $col["editrules"] = array("required"=>true); $col["editable"] = true; $cols[] = $col; $col = array(); $col["title"] = "e-Mail"; $col["name"] = "email"; # $col["width"] = "300"; // not specifying width will expand to fill space $col["sortable"] = false; // this column is not sortable $col["search"] = false; // this column is not searchable $col["editable"] = true; $cols[] = $col; $col = array(); $col["title"] = "Indirizzo"; $col["name"] = "indirizzo"; # $col["width"] = "300"; // not specifying width will expand to fill space $col["sortable"] = false; // this column is not sortable $col["search"] = false; // this column is not searchable $col["editable"] = true; $col["edittype"] = "textarea"; $cols[] = $col; $col = array(); $col["title"] = "Citta'"; $col["name"] = "citta"; # $col["width"] = "300"; // not specifying width will expand to fill space $col["sortable"] = false; // this column is not sortable $col["search"] = false; // this column is not searchable $col["editable"] = true; $cols[] = $col; $g = new jqgrid(); // set few params $grid["caption"] = "Elenco Clienti"; $grid["multiselect"] = false; $grid["autowidth"] = true; // expand grid to screen width $g->set_options($grid); $g->set_actions(array( "add"=>true, "edit"=>true, "delete"=>true, "rowactions"=>true, "export"=>false, "autofilter" => true, "search" => "simple", //"inlineadd" => true, "showhidecolumns" => false ) ); // set database table for CRUD operations $g->table = "clienti"; // subqueries are also supported now (v1.2) $g->select_command = "SELECT * FROM clienti WHERE idUtente = $id_user"; // pass the cooked columns to grid $g->set_columns($cols); // render grid $out = $g->render("Clienti"); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html> <head> <link rel="stylesheet" type="text/css" media="screen" href="js/themes/redmond/jquery-ui.custom.css"></link> <link rel="stylesheet" type="text/css" media="screen" href="js/jqgrid/css/ui.jqgrid.css"></link> <script src="js/jquery.min.js" type="text/javascript"></script> <script src="js/jqgrid/js/i18n/grid.locale-it.js" type="text/javascript"></script> <script src="js/jqgrid/js/jquery.jqGrid.min.js" type="text/javascript"></script> <script src="js/themes/jquery-ui.custom.min.js" type="text/javascript"></script> </head> <body> <div style="margin:10px"> <center><input name="" type="image" src="images/elenco_clienti.png" /> </center> <hr /> <div id="code" align="left"><a href="startpage.php" style="text-decoration: none;"><input value="Home" type="button"></a> <id="code" align="left"><a href="riparazioni.php" style="text-decoration: none;"><input value="Schede in Lavorazione" type="button"></a> <id="code" align="left"><a href="schederivenditori.php" style="text-decoration: none;"><input value="Schede CAT" type="button"></a></div> <hr /> <?php echo $out?> </div> </body> </html>
Output for 7.0.0 - 7.3.0beta1
Fatal error: Uncaught Error: Call to undefined function mysql_connect() in /in/vvenj:4 Stack trace: #0 {main} thrown in /in/vvenj on line 4
Process exited with code 255.
Output for hhvm-3.22.0
Warning: mysql_connect(): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /in/vvenj on line -1 Warning: include(inc/jqgrid_dist.php): File not found in /in/vvenj on line -1 Notice: Undefined index: id_user in /in/vvenj on line -1 Fatal error: Uncaught Error: Class undefined: jqgrid in /in/vvenj:-1 Stack trace: #0 {main}
Process exited with code 255.
Output for hhvm-3.13.2 - 3.21.3
Warning: mysql_connect(): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /in/vvenj on line 4 Warning: include(inc/jqgrid_dist.php): File not found in /in/vvenj on line 11 Notice: Undefined index: id_user in /in/vvenj on line 14 Fatal error: Uncaught Error: Class undefined: jqgrid in /in/vvenj:83 Stack trace: #0 {main}
Process exited with code 255.
Output for hhvm-3.11.1 - 3.12.14
Warning: mysql_connect(): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /in/vvenj on line 4 Warning: File not found: inc/jqgrid_dist.php in /in/vvenj on line 11 Notice: Undefined index: id_user in /in/vvenj on line 14 Fatal error: Uncaught Error: Class undefined: jqgrid in /in/vvenj:83 Stack trace: #0 {main}
Process exited with code 255.
Output for hhvm-3.10.1
Warning: mysql_connect(): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /in/vvenj on line 4 Warning: File not found: inc/jqgrid_dist.php in /in/vvenj on line 11 Notice: Undefined index: id_user in /in/vvenj on line 14 Fatal error: Class undefined: jqgrid in /in/vvenj on line 83
Process exited with code 255.
Output for 5.0.0 - 5.6.30
Fatal error: Call to undefined function mysql_connect() in /in/vvenj on line 4
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Warning: mysql_connect(): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /in/vvenj on line 4 Warning: mysql_select_db(): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /in/vvenj on line 5 Warning: mysql_select_db(): A link to the server could not be established in /in/vvenj on line 5 Warning: mysql_query(): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /in/vvenj on line 8 Warning: mysql_query(): A link to the server could not be established in /in/vvenj on line 8 Warning: main(inc/jqgrid_dist.php): failed to open stream: No such file or directory in /in/vvenj on line 11 Warning: main(): Failed opening 'inc/jqgrid_dist.php' for inclusion (include_path='.:') in /in/vvenj on line 11 Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /in/vvenj:4) in /in/vvenj on line 13 Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /in/vvenj:4) in /in/vvenj on line 13 Notice: Undefined index: id_user in /in/vvenj on line 14 Fatal error: Cannot instantiate non-existent class: jqgrid in /in/vvenj on line 83
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Warning: mysql_connect() [http://www.php.net/function.mysql-connect]: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /in/vvenj on line 4 Warning: mysql_select_db() [http://www.php.net/function.mysql-select-db]: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /in/vvenj on line 5 Warning: mysql_select_db() [http://www.php.net/function.mysql-select-db]: A link to the server could not be established in /in/vvenj on line 5 Warning: mysql_query() [http://www.php.net/function.mysql-query]: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /in/vvenj on line 8 Warning: mysql_query() [http://www.php.net/function.mysql-query]: A link to the server could not be established in /in/vvenj on line 8 Warning: main(inc/jqgrid_dist.php) [http://www.php.net/function.main]: failed to create stream: No such file or directory in /in/vvenj on line 11 Warning: main() [http://www.php.net/function.main]: Failed opening 'inc/jqgrid_dist.php' for inclusion (include_path='.:') in /in/vvenj on line 11 Warning: session_start() [http://www.php.net/function.session-start]: Cannot send session cookie - headers already sent by (output started at /in/vvenj:4) in /in/vvenj on line 13 Warning: session_start() [http://www.php.net/function.session-start]: Cannot send session cache limiter - headers already sent (output started at /in/vvenj:4) in /in/vvenj on line 13 Notice: Undefined index: id_user in /in/vvenj on line 14 Fatal error: Cannot instantiate non-existent class: jqgrid in /in/vvenj on line 83