I am making a table. For each row I would like to cycle through this if statement until it is true, and then stop (such that every row contains one element). Is there a way to do this without using goto? Here is the code I have so far for this:
<?php do { ?>
<td><?php
if((is_numeric(strpos($row_rsResults['Location'], $varLoc_rsResults)) || $row_rsResults['Location']=="USA") && is_numeric(strpos($row_rsResults['Age_group'], $varAge_rsResults)) && is_numeric(strpos($row_rsResults['Type'], $varTyp_rsResults))){
echo $row_rsResults["Organization"];
}
//else go back through if statement until $row_rsResults["Organization"] is echoed
?> </td>
EDIT:
Here is an example of the data I have and how I would like it to be displayed, if it helps:
$row_rsResults['Location']="DC, FL"
$varLoc_rsResults="DC"
$row_rsResults['Age_group']="c, d, e"
$varAge_rsResults="d"
$row_rsResults['Type']="1, 2, 3"
$varTyp_rsResults="1"
$row_rsResults['Organization']="Organization Name"
Information for each $row_rsResults is stored in a database, and each $varXxx_rsResults has a value that has been accessed from another page via GET. Ideally, I'd like the table to end up looking like this:
<table>
<tr>
<td>Organization Name 1</td>
</tr>
<tr>
<td>Organization Name 2</td>
</tr>
<tr>
<td>Organization Name 3</td>
</tr>
//etc.
</table>
With no empty rows or rows with multiple entries.
you can use for loop to solve this,
<?php do { ?>
<td><?php
for ($i=1;$i<=3;$i++)
{
if((is_numeric(strpos($row_rsResults['Location'], $varLoc_rsResults)) || $row_rsResults['Location']=="USA") && is_numeric(strpos($row_rsResults['Age_group'], $varAge_rsResults)) && is_numeric(strpos($row_rsResults['Type'], $varTyp_rsResults))){
echo $row_rsResults["Organization"];
$i=4;
}
else {
$i=1;
}
}
?> </td>