0

My Webhost UPGraded php from 5 (I think 5.3) to php 7.2.

I've been attempting to recode this for the ENTIRE DAY to NO Avail. (Getting VERY Frustrating!!!)

The Results are BLANK on the page where it USED TO display Properly.

The Code is below.

Thank you VERY Much for your help!

:D


<? 

// How many Records?
$query="SELECT COUNT(*) FROM ezines ORDER BY issue ASC";
$result = mysql_query ($query);
$row = mysql_fetch_array ($result, MYSQL_NUM);
$num_records = $row[0];

$query="SELECT * FROM ezines ORDER BY issue ASC";
$result = mysql_query ($query);
$row = mysql_fetch_array($result, MYSQL_ASSOC);
$start=$row["issue"];

if ($num_records < 10) {
    $query="SELECT * FROM ezines ORDER BY issue ASC LIMIT ".($num_records-1).", 1";
} else {
    $query="SELECT * FROM ezines ORDER BY issue DESC LIMIT 1";
}

$result=mysql_query($query);   
$row = mysql_fetch_array($result, MYSQL_ASSOC);
$finish=$row["issue"];
?>
<div><A HREF="ezine.php?archives">Issues <? echo $start; ?> to <? echo $finish; ?></A></Div>
<div>_</div>

<? 
// THIS will be 10 Most Recent, Order By Issue, Decending 
// `ezine` table
// Format Displayed Below

$query="SELECT * FROM ezines ORDER BY issue DESC LIMIT 10";
$result=mysql_query($query);
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
    echo "<div><A HREF='ezine.php?issueno=".$row["issue"]."'>Issue #".$row["issue"].":&nbsp;&nbsp;".$row["title"]."</A></div>";
    echo "<div>&nbsp;</div>"; 

}
?>
  • 1
    The `mysql_*` based functions are no longer available in 7+. Convert those to `mysqli_*` equivalents. See the PHP api, the conversion is not too bad, but some of the function arguments are swapped with some functions. – Paul T. Jan 24 '20 at 02:38
  • This post may be useful to help you convert the deprecated `mysql_*` calls - https://stackoverflow.com/questions/13944956/the-mysql-extension-is-deprecated-and-will-be-removed-in-the-future-use-mysqli – Aaron W. Jan 24 '20 at 02:41
  • The posted dupe will show you everything you need, but personally I would take this opportunity to upgrade to [`PDO`](https://www.php.net/manual/en/book.pdo.php). [This Q&A](https://stackoverflow.com/questions/28096054/how-to-replace-mysql-functions-with-pdo) gives a good description of how to convert. – Nick Jan 24 '20 at 02:43

0 Answers0