3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $con=mysqli_connect("localhost","root","Krishna19942","newhopehospital"); // Check connection if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } // escape variables for security $fname = mysqli_real_escape_string($con, $_POST['fname']); $lname = mysqli_real_escape_string($con, $_POST['lname']); $address= mysqli_real_escape_string($con, $post['address']); $pnum= mysqli_real_escape_string($con, $post['pnum']); $emptype= mysqli_real_escape_string($con, $post['emptype']); $wardname= mysqli_real_escape_string($con, $post['wardname']); $speciality= mysqli_real_escape_string($con, $post['speciality']); $sql="INSERT INTO doctordetails values ('','$fname','$lname','$address','$pnum','$emptype','$wardname','$speciality')"; $sql="update warddetails set Ward_Charge='$fname' where WardName='$wardname'"; if (!mysqli_query($con,$sql)) { die('Error: ' . mysqli_error($con)); } echo "1 record added"; echo "<br><br>"; //$sql="select * from kr.personal"; //testing 2.......// //if($_POST["fname"] && $_POST["lname"] && $_POST["address"] && $_POST["pnum"] && $_POST["emptype"] && $_POST["wardname"] && $_POST["speciality"] ) //{ // $servername="localhost"; // $username="root"; // $password="Krishna19942"; // $conn= mysql_connect($servername,$username,$password)or die(mysql_error()); // mysql_select_db("newhopehospital",$conn); // $sql="insert into doctordetails values ('$fname','$lname','$address','$pnum','$emptype','$wardname','$speciality')"; // $result=mysql_query($sql,$conn) or die(mysql_error()); //} //else print"invaild input data"; mysqli_close($con); header("Location: ../new_doctor.php"); exit; ?>
Output for 7.0.0 - 7.1.0
Fatal error: Uncaught Error: Call to undefined function mysqli_connect() in /in/f65IR:2 Stack trace: #0 {main} thrown in /in/f65IR on line 2
Process exited with code 255.
Output for 5.0.0 - 5.6.28
Fatal error: Call to undefined function mysqli_connect() in /in/f65IR on line 2
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: mysqli_connect() in /in/f65IR on line 2
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: mysqli_connect() in /in/f65IR on line 2
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: mysqli_connect() in /in/f65IR on line 2