Hello,
I hope somone can help me.
I have a form that a user use to search for their pay, and it will dispay it for them as both with dependents and without.
Right now they can search and it will display their pay, but it displays it as two seperat rows. so it will display the pay in both the with and without section for the 'with' and then it does the same for the 'without'.
I have a database that has 2 tables sorted_zipmhaYY and bahwYY.
I would like to have it show 1 record that shows how much they will get with or without dependents. I have tried doing
if ($row['dependents']='with'){ ...}
if ($row['dependents']='without'){ ...}
But this just created a loop.
<div id="search_results">
<?php
if(isset($_GET['zipcode'])){
$zipcode = trim($_POST['zipcode']) ;
$zipcode = mysql_real_escape_string($zipcode);
if(isset($_GET['field_rank'])){
$rank = trim($_POST['field_rank']) ;
$rank = mysql_real_escape_string($rank);
if(isset($_GET['YEAR'])){
$year = trim($_POST['YEAR']) ;
$year = mysql_real_escape_string($year);
$query = "SELECT $rank, ZIPCODE, Dependents, YEAR FROM sorted_zipmhaYY
LEFT JOIN bahwYY ON sorted_zipmhaYY.MHA=bahwYY.MHA
WHERE ZIPCODE='$zipcode' AND YEAR='$year' ORDER BY sorted_zipmhaYY.zipcode ASC";
echo $query;
//echo $query;
$result = mysql_query($query) or die(mysql_error());
if($result){
/* if(mysql_affected_rows($link)!=0){*/
while($row = mysql_fetch_array($result,MYSQL_ASSOC)){
echo '<div id="style"><p> <b> <small> Zipcode: </small>'.$zipcode.
'</div></b></p><br />
<div id="style"><p> <b> <small> Year: </small>'.$row['YEAR'].
'</div></b></p>
<div id="style"><p> <b> <small> Recomended BAH for a '.$rank.' with dependents: </small>$'.$row[$rank].
'</div></b></p><br />
<div id="style"><p> <b> <small> Recomended BAH for a '.$rank.' without dependents Status: </small>'.$row[$rank].
'</div></b></p> <hr>';
}
}else {
echo 'No Results for Zipcode "'.$_POST['zipcode'].'"';
/* }
*/
}
}else {
echo 'Parameter Missing';
}
}
}
?></div>
Any help would be appreciated.
Thanks,
Aaron