3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php define("DB_HOST", "www.sql2.webzdarma.cz"); define("DB_USER", "taxidiary.wz6133"); define("DB_PASSWORD", "v6ir53b3"); define("DB_DATABASE", "taxidiary.wz6133"); $conn = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD); if(!mysql_select_db(DB_DATABASE)) { print "Připojení k DB selhalo..."; } $selected_db = mysql_select_db("jizdy", $conn); if(!$selefcted_db) { echo "DB not found"; } function store_drive($from, $to, $price) { $date = date("Y-n-d H:i:s"); $result = mysql_query("INSERT INTO jizdy(odkud, kam, cena, datum) VALUES('".$from."','".$to."','".$price."','".$date."')"); } if(isset($POST['submit'])) { $from = isset($POST['from']) ? $POST['from'] :""; $to = isset($POST['to']) ? $POST['to'] :""; $price = isset($POST['price']) ? $POST['price'] :""; if(isset($POST['price'])) { store_drive($from, $to, $price); } } function get_week() { $date = date("Y-n-d"); $result = mysql_query("SELECT * FROM jizdy WHERE datum >= '$date'"); $rows = mysql_num_rows($result); while($row = mysql_fetch_array($rows, MYSQL_ASSOC)) { print("<tr> <td>".$row['odkud']."</td> <td>".$row['kam']."</td> <td>".$row['cena']."</td> <td>".$row['datum']."</td> </tr>"); } }
based on 3fS1k
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught Error: Call to undefined function mysql_connect() in /in/jZoa7:8 Stack trace: #0 {main} thrown in /in/jZoa7 on line 8
Process exited with code 255.
Output for 5.5.0 - 5.6.28
Fatal error: Call to undefined function mysql_connect() in /in/jZoa7 on line 8
Process exited with code 255.