Basically, I make a query based on the first query that I made.
It returns the right number of rows but it only displays the first record based on the number of rows.
For example, if my second query returns Result1 and Result2, the table will look like
Result1
Result1

<?php do { ?> 
  <? 
  		$keyword_anasearch = $row_topicsearch['bCN'];
  		$query_anasearch = "SELECT  tblaccession.aStatus, tblbooks.bCN, tblaccession.aAN, tblbooks.bTitle, tblbooks.bPublisher, tblbooks.bCategory FROM tblaccession, tblbooks WHERE tblbooks.bCN LIKE '%".$row_topicsearch['bCN']."%' AND tblbooks.bCN = tblaccession.aCN AND tblaccession.aStatus = 'Available' ";
	$anasearch = mysql_query($query_anasearch, $mysqlcon) or die(mysql_error());
	$row_anasearch = mysql_fetch_assoc($anasearch);
	$totalRows_anasearch = mysql_num_rows($anasearch);
	echo $totalRows_anasearch;
    
    do {   
 ?>
    <tr>
      <td><?php echo $row_anasearch['bCN']; ?></td>
      <td><?php echo $row_anasearch['aAN']; ?></td>
      <td><?php echo $row_anasearch['bTitle']; ?></td>
      <td></td>
      <td><?php echo $row_anasearch['bPublisher']; ?></td>
      <td><?php echo $row_anasearch['bCategory']; ?></td>
    </tr>
    <? } while($row=mysql_fetch_assoc($anasearch)); ?>
 <?php } while ($row_topicsearch = mysql_fetch_assoc($topicsearch)); ?>

I think you need to change $row on line 20 to $row_anasearch .

Am not sure what you are after, but I'd use a different construct.

commented: Thank you very much :D that's exactly what I was looking for +1
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.