3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php session_start(); $host="fenrir"; // Host name $username="x"; // Mysql username $password="x"; // Mysql password $db_name="x"; // Database name $tbl_name="register_users"; // Table name // Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); // username and password sent from form $myBirthDay=$_POST['myBirthDay']; $myEmail=$_POST['myEmail']; echo $_SESSION['myFirstName'], $_SESSION['myLastName'], $myLastName, $myBirthDay, $myEmail; // To protect MySQL injection (more detail about MySQL injection) $myBirthDay = stripslashes($myBirthDay); $myEmail = stripslashes($myEmail); $myBirthDay = mysql_real_escape_string($myBirthDay); $myEmail = mysql_real_escape_string($myEmail); $sql="INSERT INTO $tbl_name (id, firstName, lastName, birthDay, email) VALUES(0, $myFirstName, $myLastName, $myBirthDay, $myEmail);"; $result=mysql_query($sql); // Mysql_num_row is counting table row $count=mysql_num_rows($result); // If result matched $myusername and $mypassword, table row must be 1 row if($count==1){ echo "Success."; } else { echo "Wrong Username or Password"; } ?>
Output for 7.0.0 - 7.1.0
Fatal error: Uncaught Error: Call to undefined function mysql_connect() in /in/e9XNH:10 Stack trace: #0 {main} thrown in /in/e9XNH on line 10
Process exited with code 255.
Output for hhvm-3.10.0 - 3.12.0
Warning: mysql_connect(): Unknown MySQL server host 'fenrir' (111) in /in/e9XNH on line 10 cannot connect
Output for 5.2.3 - 5.6.28
Fatal error: Call to undefined function mysql_connect() in /in/e9XNH on line 10
Process exited with code 255.
Output for 5.0.0 - 5.2.2
Warning: session_start(): Cannot send session cookie - headers already sent in /in/e9XNH on line 2 Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /in/e9XNH:2) in /in/e9XNH on line 2 Fatal error: Call to undefined function mysql_connect() in /in/e9XNH on line 10
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Warning: session_start(): Cannot send session cookie - headers already sent in /in/e9XNH on line 2 Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /in/e9XNH:2) in /in/e9XNH on line 2 Warning: mysql_connect(): Unknown MySQL Server Host 'fenrir' (0) in /in/e9XNH on line 10 cannot connect
Output for 4.3.0 - 4.3.1
Warning: session_start() [http://www.php.net/function.session-start]: Cannot send session cookie - headers already sent in /in/e9XNH on line 2 Warning: session_start() [http://www.php.net/function.session-start]: Cannot send session cache limiter - headers already sent (output started at /in/e9XNH:2) in /in/e9XNH on line 2 Warning: mysql_connect() [http://www.php.net/function.mysql-connect]: Unknown MySQL Server Host 'fenrir' (0) in /in/e9XNH on line 10 cannot connect