I presume you mean you see all the print_r's for each row and that you
only see one row echo'd out in your html?
You have your brackets in the wrong place, it should be something like this:
if ($f_date != "") {
while($row = ifx_fetch_row($info)) {
//set your variables
//echo out your html
} //end while
} //end if
Dan Shirah wrote:
Hello all!
I'm having some weirdness with a loop. I am adding an conditional statement
to my script to see if a condition is met before running a loop. All of the
code up to this point works great so I have not included it since it is very
long and extensive. Basically I have a query that runs and is output to
$info. This is where the code below picks up.
Whenever I add the if() I only get one result returned. But if I simply
delete the if() statement I get all of the rows returned.
Is there some weirdness where the closing backet of the if() statement gets
interpretted by PHP to be the closing bracket of the while loop?
print_r($row); does display all of the results from my query so I know they
are in there. So the only thing I could think of is the curly braces being
used for the while() before the if()
<?php
if ($f_date!="") { // Start of IF
while ($row = ifx_fetch_row($info)) { // Start of While
$case_date = $row['caa61140005'];
$case_type = substr($row['caa38840002'], 4);
$case_id = $row['caa443400018'];
$case_num = TRIM($row['caa44340041']);
$case_title = TRIM($row['caa44340002']);
$case_category = TRIM($row['caa443400013']);
print_r($row);
} // End of IF
?>
<tr>
<td width='300' id="<?php echo $case_num; ?>" height='13' align='center'
class='tblcell'><div align='left' id="<?php echo $case_num; ?>"><img
src="Images/Next1.gif"><a href="javascript:caseDetail('<?php echo $case_id;
?>','<?php echo $case_title; ?>','<?php echo $party_name; ?>','<?php echo
$case_num; ?>')"><?php echo $party_name."<br />\n".$case_num;
?></a></div></td>
</tr>
<?php
} //End of While
?>
Any ideas?
Thanks,
Dan
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php