3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $q = intval($_GET['q']); $con = mysqli_connect('localhost','peter','abc123','my_db'); if (!$con) { die('Could not connect: ' . mysqli_error($con)); } mysqli_select_db($con,"ajax_demo"); $sql="SELECT * FROM user WHERE id = '".$q."'"; $result = mysqli_query($con,$sql); echo "<table border='1'> <tr> <th>Firstname</th> <th>Lastname</th> <th>Age</th> <th>Hometown</th> <th>Job</th> </tr>"; while($row = mysqli_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['FirstName'] . "</td>"; echo "<td>" . $row['LastName'] . "</td>"; echo "<td>" . $row['Age'] . "</td>"; echo "<td>" . $row['Hometown'] . "</td>"; echo "<td>" . $row['Job'] . "</td>"; echo "</tr>"; } echo "</table>"; mysqli_close($con); ?>
Output for 7.0.0 - 7.1.0
Notice: Undefined index: q in /in/ZrqL3 on line 2 Fatal error: Uncaught Error: Call to undefined function mysqli_connect() in /in/ZrqL3:4 Stack trace: #0 {main} thrown in /in/ZrqL3 on line 4
Process exited with code 255.
Output for 5.3.0 - 5.6.28
Notice: Undefined index: q in /in/ZrqL3 on line 2 Fatal error: Call to undefined function mysqli_connect() in /in/ZrqL3 on line 4
Process exited with code 255.
Output for 5.0.0 - 5.2.17
Notice: Undefined index: q in /in/ZrqL3 on line 2 Fatal error: Call to undefined function mysqli_connect() in /in/ZrqL3 on line 4
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Notice: Undefined index: q in /in/ZrqL3 on line 2 Fatal error: Call to undefined function: mysqli_connect() in /in/ZrqL3 on line 4
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Notice: Undefined index: q in /in/ZrqL3 on line 2 Fatal error: Call to undefined function: mysqli_connect() in /in/ZrqL3 on line 4
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Notice: Undefined index: q in /in/ZrqL3 on line 2 Fatal error: Call to undefined function: mysqli_connect() in /in/ZrqL3 on line 4