-1
<body>
<?php
 include 'includes/header.php';
 include 'includes/modal.php';
 include 'includes/loginmodal.php';
 include 'includes/db_connect.php';
?>
<?php
  $query = "SELECT * FROM onePiece";
  $result = mysql_query($query);
  if(mysql_num_rows($result>0))
  {
    while($row = mysqli_fetch_assoc($result))
    {?>
        <div class="page-header">
            <h2><?php echo ($row['mangatitle']); ?></h2>
        </div>
   <?php    
    }
   }
   ?>
 </body>
</html>

I am extracting the title from the database but getting this error- mysql_num_rows() expects parameter 1 to be resource boolean given in C:\xampp\htdocs\ait\opchap1.php on line 17

Kay
  • 142
  • 2
  • 10

2 Answers2

1
if(mysql_num_rows($result>0))

Replace this with

if(mysql_num_rows($result)> 0)

The brackets directly after the num rows is where you declare the variable after that you can set your condition

Adam Hull
  • 214
  • 2
  • 10
0

Solved!! I didn't provide the DB name in db_connect.

$conn = new mysqli($dbhost, $dbuser, $dbpass,$dbname);

My bad.

Kay
  • 142
  • 2
  • 10