3v4l.org

run code in 300+ PHP versions simultaneously
<?php // connect to database //db_host = "localhost" ; $db_name = "maffeij_art" ; //$db_user = "maffeij" ; //$db_password = "a1yorkie" ; //@ $db = mysql_pconnect('localhost','maffeij_maffeij','sheepish1986'); $db = mysqli_connect('localhost', 'maffeij_maffeij', 'sheepish1986', 'maffeij_art'); if(!$db) { echo 'Could not connect to the database'; exit; } // select table mysql_select_db ('maffeij_art'); // see if we should be showing the category or the sub category $sub = trim($_POST['sub']); if(empty($sub)) { // we didn't come from an edit record, we came from a results page // so grab the id appended to the url $sub = $_GET['sub']; } ?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <meta name="GENERATOR" content="Microsoft FrontPage 4.0"> <meta name="ProgId" content="FrontPage.Editor.Document"> <title>Contents</title> </head> <!-- <body text="#000000" link="#666666" vlink="#808080" alink="#000000" bgcolor="#CCCCCC"> --> <body text="#000000" link="#666666" vlink="#808080" alink="#000000" bgcolor="#666666"> <p align="center">&nbsp;</p> <p align="center"> <?php if($sub == '') { echo "<a href='detail.php?id=179&home=1' target ='mainframe'><img border='0' src='images/home.gif' width='140' height='40'></a>"; } else { //echo "<a href='contents.php' target ='menuframe'><img border='0' src='images/back.gif' width='140' height='40'></a>"; echo "<a href='contents.php'><img border='0' src='images/return.gif' width='140' height='40'></a>"; } echo "<img border='0' src='images/line.gif'>"; if($sub == '') { $query = 'select * from category order by catorder'; } else { $query = "select * from subcategory where parentid = ".$sub." order by subcatorder"; } $result = mysql_query($query); $num_results = mysql_num_rows($result); for($i=0; $i < $num_results; $i++) { $row = mysql_fetch_array($result); $id = htmlspecialchars(stripslashes($row['id'])); $parentid = htmlspecialchars(stripslashes($row['parentid'])); $name = htmlspecialchars(stripslashes($row['name'])); $url = htmlspecialchars(stripslashes($row['url'])); $image = htmlspecialchars(stripslashes($row['image'])); $target = htmlspecialchars(stripslashes($row['target'])); if($image != '') { if($url != '') { if($target == '') { echo "<a href='$url'><img border='0' src='images/$image' width='140' height='40'></a>"; } else { echo "<a href='$url' target = '$target'><img border='0' src='images/$image' width='140' height='40'></a>"; } } else { echo "<img border='0' src='images/$image' width='140' height='40'>"; } } else { if($url != '') { if($target == '') { echo "<a href='$url'>".$name."</a>"; } else { echo "<font color='#666666' size='1' face='Arial Special G1'><a href='$url' target = '$target'>".$name."</a>"; } } else { echo $name; } } //echo $name; } ?> <!-- <base target="mainframe"> <CENTER> <form action="browse.php" method="post"> &nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="keyword" SIZE="10"> &nbsp;&nbsp;&nbsp;&nbsp;<input type="image" src="images/search.gif"> </form> </CENTER> <p align="center">&nbsp;</p> --> </body> </html>
Output for 7.0.0 - 7.0.33, 7.1.0 - 7.1.25, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
Fatal error: Uncaught Error: Call to undefined function mysqli_connect() in /in/74FGD:14 Stack trace: #0 {main} thrown in /in/74FGD on line 14
Process exited with code 255.
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 Fatal error: Uncaught Error: Call to undefined function mysqli_connect() in /in/74FGD:14 Stack trace: #0 {main} thrown in /in/74FGD on line 14
Process exited with code 255.
Output for 5.6.38
Fatal error: Call to undefined function mysqli_connect() in /in/74FGD on line 14
Process exited with code 255.

preferences:
196.86 ms | 401 KiB | 216 Q