0

Recently our sites sidebar disappeared after php upgrade on server. Following is the code. It is due to the mysql_fetch_array getting obsolete. I will be thankful if you could guide on how I can accomplish the same thing without getting onto mysqli

                    <h3 class="widget-title">LATEST NEWS</h3>
<?php
 $Q = "SELECT * FROM 'wp_posts' WHERE 'post_type' = 'post' AND   'post_status' = 'publish' ORDER BY 'wp_posts'.'post_date' DESC LIMIT 0 , 5";
$QR = mysql_query($Q);
while($QRF = mysql_fetch_array($QR))
{
?>
    <li>
    <?php echo get_the_post_thumbnail($QRF['ID'], array(50,61)); ?>
        <p>
         <span><?php echo date("d/m/Y",strtotime($QRF['post_date']));?></span><br /> 
         <a href="http://www.doonschool.com/<?php echo $QRF['post_name'];?>"><?php echo $QRF['post_title'];?></a>
       </p>
     </li>
<?php }?>
Vishal Mohla
  • 71
  • 1
  • 7
  • 1
    *"without using mysqli on php 7"* - **Can't be done**. – Funk Forty Niner Feb 07 '16 at 18:31
  • This means I will have to change the entire code of the wordpress site just to get 5 posts. Any other alternative? The site is working fine otherwise. – Vishal Mohla Feb 07 '16 at 18:33
  • Why don't you want to use MySQLi? The MySQL interface has been deprecated for long enough, with plenty of warning, and finally dropped completely; so there's really no excuse for not having done the upgrade to the superior MySQLi – Mark Baker Feb 07 '16 at 18:34
  • The alternatives are that you downgrade to PHP 5 again; or configure your wordpress to use MySQLi – Mark Baker Feb 07 '16 at 18:34

0 Answers0