hi there
I have a form category in html which has jobtitle set to multiple for selecting more than category eg. optician and receptionist
I want to be able to display the total number of results of more than one category returned using mysql_num_rows($result); and while ($item = mysql_fetch_row($result)) :-
here is the code
<?php
$jobtitle= $_POST ['jobtitle']; //form variable
$jobtitlepos=265; //position for displayed result
foreach ($jobtitle as $value){
$job=$value;
$sqlquery ="SELECT entryID,negotiate, rates,posted,jobtitle,worktime,minimumsalary ,maximumsalary , salary, location, LEFT(description,10) FROM recruitment WHERE jobtitle LIKE '$job' ";
$result = mysql_query($sqlquery);
$resulto=mysql_num_rows($result);
////////////////////////////display no. of search results////////////
echo '<div>Your jobsearch found '.$resulto.' results today. </div>';
//display result
while ($item = mysql_fetch_row($result)) {
echo '<div class=jobtitle id="Layer3" style="position:absolute; left:736px; top:'.$jobtitlepos.'px; width:370px; height:15px; z-index:24">',$item[4],' <br>jobtitle</div>';
$jobtitlepos=$jobtitlepos+155;
}
}
?>
What happens is the result when i select 2 different job categories in the form and click submit
Your jobsearch found '.$resulto.' results today.
it displays 2 lots of results :-
eg if there were- 3 opticians in table and 2 receptionists in same table
the figure 3 displays on top of figure 2 instead of adding 3+2 to show the result as 5
the foreach statement gets reset to give 2 results instead of one??
help please
rooky