While Loop mysteriously Stops at 1st row!

Hello,

We have a really bit of mystery on our hand here which I am hoping you can help with.

We have a While Loop which when it has more than 1 rows it, it is still STOPPING at row 1 and not printing the other rows!

You can see in this example that it has 7 rows:
echo 'Num Rows are: ’ . mysql_num_rows($query_get_ans);

it prints out: Num Rows are: 7

But the while Loop which is listed below only prints out the 1st Row! What is the problem?

while ($result_get_ans = mysql_fetch_array($query_get_ans)) {

	$ans_id = $result_get_ans['a_id'];
	$q_id = $result_get_ans['qa_id'];
	$ans_date_added = $result_get_ans['date_added'];
	$q_head_line = $result_get_ans['head_line'];
	$ans_body = $result_get_ans['body'];
	$admin_status = $result_get_ans['admin_status'];

?>
<tr bgcolor=“#ffffff”>
<td align=“center”>
<?php echo $num; ?>
</td>
<td align=“center”>
<?php echo $ans_date_added; ?>
</td>
<td align=“left”>
<?php echo $q_head_line; ?>
</td>
<td align=“left”>
<?php echo ‘<a href="qanda.php?q_id=’ . $q_id . ‘">’ . $ans_body . ‘</a>’; ?>
</td>
<td align=“center”>
<?php echo $admin_status; ?>
</td>
</tr>

	&lt;?php
		}//CLOSES While Loop
	?&gt;

ThanX,

are you doing anything else with $query_get_ans before this loop begins?

Hi,

Just this:

if (mysql_num_rows($query_get_ans) == 0) {

			echo 
			'&lt;tr bgcolor="#ffffff"&gt;
			&lt;td colspan="7" valign="middle" align="center"&gt;
			&lt;div class="anx_text_lbl"&gt;
				No Answers Posted by me yet - &lt;a href="qs_by_cat.php"&gt;View Recent Questions&lt;/a&gt;
			&lt;/div&gt;
			&lt;/td&gt;
			&lt;/tr&gt;
			';

} else {

     while ($result_get_ans = mysql_fetch_array($query_get_ans)) {

Hey,

I figured what the problem is.
Something really stupid. A typo really. What you get when 1 person (me) is doing 10 peoples work :frowning:

ThanX anyway & have a great day :slight_smile: