3v4l.org

run code in 300+ PHP versions simultaneously
<?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.0.27, 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
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 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 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 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.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.3.11, 4.4.0 - 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

preferences:
306.01 ms | 405 KiB | 383 Q