3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo "<table cellpadding = 10>"; echo '<tr>'; echo '<th>3D table</th>'; $c = 0; if ($c >= $cols) { echo '</tr>'; $c = 0; } $start = '2014-04-01'; $end = '2014-04-31'; //for ($x=0;$x<count($values);$x++) { $sql = "SELECT empName, date, timeIn FROM attendance WHERE date >= '$start' AND date <= '$end' GROUP BY empName ORDER BY empName ASC"; $searchQuery = mysql_query("SELECT date FROM attendance GROUP BY DAY(date) ORDER BY date DESC LIMIT 20") or die($searchQuery."<br/><br/>".mysql_error()); $nums = mysql_num_rows($searchQuery); $rQuery = mysql_query($sql) or die($rQuery . "<br/><br/>" . mysql_error()); $num = mysql_num_rows($rQuery); for($y = 0; $y < $num; $y++) { $row = mysql_fetch_array($rQuery); echo '<tr>'; echo '<td class="odd">'. $row['empName'] .'</td>'; for($i = 0; $i < $nums; $i++) { $rows = mysql_fetch_array($searchQuery); echo '<td class="even">'.$rows['date'].'</td>'; }echo $y; echo '</tr>'; }
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
<table cellpadding = 10><tr><th>3D table</th> Warning: Undefined variable $cols in /in/9XYfY on line 7 </tr> Fatal error: Uncaught Error: Call to undefined function mysql_query() in /in/9XYfY:16 Stack trace: #0 {main} thrown in /in/9XYfY on line 16
Process exited with code 255.
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.12 - 7.3.31, 7.4.0 - 7.4.33
<table cellpadding = 10><tr><th>3D table</th> Notice: Undefined variable: cols in /in/9XYfY on line 7 </tr> Fatal error: Uncaught Error: Call to undefined function mysql_query() in /in/9XYfY:16 Stack trace: #0 {main} thrown in /in/9XYfY on line 16
Process exited with code 255.
Output for 7.3.32 - 7.3.33
<table cellpadding = 10><tr><th>3D table</th></tr> Fatal error: Uncaught Error: Call to undefined function mysql_query() in /in/9XYfY:16 Stack trace: #0 {main} thrown in /in/9XYfY on line 16
Process exited with code 255.
Output for 5.0.4 - 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.24 - 5.5.35, 5.6.7 - 5.6.28
<table cellpadding = 10><tr><th>3D table</th> Notice: Undefined variable: cols in /in/9XYfY on line 7 </tr> Fatal error: Call to undefined function mysql_query() in /in/9XYfY on line 16
Process exited with code 255.
Output for 5.0.0 - 5.0.3
<table cellpadding = 10><tr><th>3D table</th> Notice: Undefined variable: cols in /in/9XYfY on line 7 </tr> Fatal error: Call to undefined function mysql_query() in /in/9XYfY on line 16
Process exited with code 255.
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.9
<table cellpadding = 10><tr><th>3D table</th> Notice: Undefined variable: cols in /in/9XYfY on line 7 </tr> Warning: mysql_query(): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /in/9XYfY on line 16 Warning: mysql_query(): A link to the server could not be established in /in/9XYfY on line 16 <br/><br/>Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
Output for 4.3.0 - 4.3.1
<table cellpadding = 10><tr><th>3D table</th> Notice: Undefined variable: cols in /in/9XYfY on line 7 </tr> 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/9XYfY on line 16 Warning: mysql_query() [http://www.php.net/function.mysql-query]: A link to the server could not be established in /in/9XYfY on line 16 <br/><br/>Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

preferences:
190.73 ms | 402 KiB | 314 Q