Updated to PHP 7.0 and it broke my programming

<?php include('../db/connect.php'); 
foreach($_REQUEST as $key=>$value) {
$$key=$value;
} ?>
<? $sql = "SELECT * from databasename WHERE photostat='1' order by photoid desc";

$result = @mysql_query($sql, $connection) or die(mysql_error());
while ($row = mysql_fetch_array($result)) {
$photoid = $row['photoid'];
$photocase = $row['photocase'];
$photoname = $row['photoname'];
$photofolder = $row['photofolder'];
$photocaption = $row['photocaption'];
$photostat = $row['photostat']; ?>
<a href="displayphoto.php?photoid=<?=$photoid?>"><img src="<?=$photofolder?>/<?=$photoname?>" width="150" border="2"></a> &nbsp;<? }; 
?>

This was a very rudimentary photo album that I wrote years ago. The newest PHP 7.0 broke the code.
I am retired and no longer programming, but want to get this working again. Any suggestions?

Php didnt break anything. Your code is obsolete and has been completely removed from PHP. You will need to do a complete re-write using PDO with Prepared Statements. There is no “fixing” this code.

Php website has had a big red warning box for well over 10 years that this day would come.

Sponsor our Newsletter | Privacy Policy | Terms of Service