3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php require_once('config.php'); // page title $pagetitle="Results - ".$sitename; require_once('login.php'); $totalmarks = '50'; $passingmarks = '18'; $totalpassing = '33'; // total passing percentage ?> <!DOCTYPE html> <html> <head> <title><?=$pagetitle?></title> <script> function printpage() { window.print() } </script> </head> <body style="text-align:center"> <?php if($_GET['id']){ $id=mysql_real_escape_string($_GET['id']); $uq=mysql_query("SELECT * FROM $tbl_name WHERE id='$id'") or die("ERROR"); $u=mysql_fetch_array($uq); $user_name=$u['user_name']; $rq=mysql_query("SELECT * FROM $tbl2 WHERE user='$user_name'") or die("Error fetching result"); ?> <div class="content2" style="center;width:780px"> <div style="text-align:center;margin-bottom:20px;overflow:hidden"> <a style="float:right;" href="#" onClick="printpage()">Print</a> <a href="/" ><img style="width: 500px;height: 130px;" src="images/logo-main.png" alt="logo" title="The Lahore Institute" /></a> <hr/> </div> <div> <div style="font-weight:bold;text-align:center;margin-bottom:10px;"> Roll No: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <?=$u['id']?><br/> Name: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?=$u['fullname']?><br/> </div> <table width="450" border="0" align="center" cellpadding="1" cellspacing="0" style="border:1px solid #666;border-radius:10px;"> <tr bgcolor="#003063"> <td style="padding:5px;"><strong style="color:#fff">Name of Paper </strong></td> <td style="padding:5px;"><div style="color:#fff" align="center"><strong>Marks Obtained</strong></div></td> <td style="padding:5px;"><div style="color:#fff" align="center"><strong>Total Marks</strong></div></td> <td style="padding:5px;"><div style="color:#fff" align="center"><strong>Status</strong></div></td> </tr> <?php while($r=mysql_fetch_array($rq)){ $i='0'; $i++; if($_SESSION['allmarks']){ $_SESSION['allmarks']=$_SESSION['allmarks']+$r['marks']; } else { $_SESSION['allmarks']=$r['marks']; } echo "<tr>"; if($r['marks']<$passingmarks){ $status='Fail'; } echo '<td style="padding:5px;" align="left">'.$r['subject'].'</td>'; echo '<td style="padding:5px;"><div align="center"><em><strong>'.$r['marks'].'</strong></em></div></td>'; echo '<td style="padding:5px;"><div align="center">'.$totalmarks.'</div></td>'; echo '<td style="padding:5px;"><div align="center">'.$status.'</div></td>'; echo "</tr>"; ?> <?php } $totalall=$i*$totalmarks; $totallgained=$_SESSION['allmarks']; if($totallgained*100/$totallall<$totalpassing){ $fstatus='Failed'; } else { $fstatus='Passed'; } if($fstatus!=='Failed'){ $comments=$passingcomments; } else { $comments=$failingcomments; } ?> </table> <div style="margin-top:10px;text-align:center;font-weight:bold;">Total Marks: <?=$totalgained?><br/>Final Status: <?=$fstatus?><br/>Comments: <?=$comments?><br/></div> </div> </div> </body> </html> <?php } else { require_once('header.php'); ?> <div class="content2"> <h2>Get Result</h2><hr/> <div style="text-align:center"> <span style="color:#F00">*</span> &nbsp; Enter your Roll number and click GET to get your result<br /> <br /> <br /> <form action="result.php" method="get"> <input type="text" name="id" id="id" placeholder="Enter Roll No." size="35" /><br /> <br /> <input style="width: 100px;" type="submit" name="Submit" value="GET" /> </form> </div> </div> <?php require_once('footer.php'); } ?>
Output for 5.1.0 - 5.6.28, 7.0.0 - 7.1.0
Warning: require_once(config.php): failed to open stream: No such file or directory in /in/TgL8O on line 2 Fatal error: require_once(): Failed opening required 'config.php' (include_path='.:') in /in/TgL8O on line 2
Process exited with code 255.
Output for hhvm-3.10.0 - 3.12.0
Fatal error: File not found: config.php in /in/TgL8O on line 2
Process exited with code 255.
Output for 4.3.2 - 5.0.5
Warning: main(config.php): failed to open stream: No such file or directory in /in/TgL8O on line 2 Fatal error: main(): Failed opening required 'config.php' (include_path='.:') in /in/TgL8O on line 2
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Warning: main(config.php) [http://www.php.net/function.main]: failed to create stream: No such file or directory in /in/TgL8O on line 2 Fatal error: main() [http://www.php.net/function.main]: Failed opening required 'config.php' (include_path='.:') in /in/TgL8O on line 2