Jump to content

help with this code...


jesushax

Recommended Posts

hi below is my code

 

what im trying to do is for every category of VacCat so there is multiple records under the same VacCat

open a new table.

 

so for every new VacCat there will be a table

 

and in these tables are the records

then after the records have finished looping close each table

 

im ok up to the closing each table part, i cant get the closing to work

 

anyone see why?

 

Thanks

 

<?php
include($_SERVER['DOCUMENT_ROOT'] . '/new/includes/connection.php'); 
include($_SERVER['DOCUMENT_ROOT'] . '/new/includes/header.php'); 
?>
<p>Below are our current listed vacancies, 
Please click <a href='/seekers/rec_reg/register.asp'>here</a> to pre register with us and one
of our friendly team will get back to you with more details and to arrange an interview.</p>
<hr />
<? 
//dim $SQL, $row, $currCat, $currCatID, $recordID;
$SQL = mysql_query("SELECT * FROM tblVac WHERE VacArchive='0' AND VacRef NOT LIKE 'VIV-%' ORDER BY VacCat, VacDateAdded DESC") or die (mysql_error());

?>
<div style="text-align:right"><a href="javascript:vac.sweepToggle('contract')">Contract All</a> | <a href="javascript:vac.sweepToggle('expand')">Expand All</a></div>
<?
$recordID = 0;
while ($row = mysql_fetch_array($SQL)) {
	if ($recordID == 0 || $currCat != $row["VacCat"]) {
		$currCat = $row["VacCat"];
		$currCatID = $row["VacID"];
		echo '<div id="Vac'.$currCatID.'-title" style="font-size:10px; cursor:pointer;">To see all our <b>'.$currCat."\n";
		echo "</b>vacancies click here</div>"."\n";
		echo "<br />"."\n";			
		echo '<div id="Vac'.$currCatID.'" class="switchgroup1">'."\n";
		echo '<table width="550">'."\n";
		echo "<tr><td></td></tr>"."\n";
		echo "<tr>"."\n";
		echo '<td style="width:260px;" class="vactitle">Vacancy Title</td>'."\n";
		echo '<td style="width:135px;" class="vactitle">Location</td>'."\n";
		echo '<td style="width:110px;" class="vactitle">Hours</td>'."\n";
		echo '<td style="width:50px;" class="vactitle">Ref No</td>'."\n";
		echo "</tr>"."\n";
	}


	echo '<tr onmouseover="this.className=\'hover\';" onmouseout="this.className=\'static\';" onclick="return popup(\'vacancy.asp?id='.$row["VacId"].'\',\'NewPage\');">'."\n";
	echo "<td>".$row["VacTitle"]."</td>"."\n";
	echo "<td>".$row["VacLocation"]."</td>"."\n";
	echo "<td>".$row["VacHrs"]."</td>"."\n";
	echo "<td>".$row["VacRef"]."</td>"."\n";
	echo "</tr>"."\n";


	$recordID = $recordID + 1;

if ($recordID > 0) {
echo "</table>"."\n";
echo "</div>"."\n";
echo "</div>"."\n";	
echo "<p></p>"."\n"."\n";
	}

}
?>
<script type="text/javascript">
<!--
var vac=new switchcontent("switchgroup1", "div") //Limit scanning of switch contents to just "div" elements
vac.setStatus('<img src="/admin/images/close.gif" alt="close" /> ', '<img src="/admin/images/open.gif" alt="Open" /> ')
vac.setColor('darkred', 'black')
vac.setPersist(false)
vac.collapsePrevious(true) //Only one content open at any given time
vac.init()
// -->
</script>
<?php include($_SERVER['DOCUMENT_ROOT'] . '/new/includes/footer.php'); ?>

Link to comment
https://forums.phpfreaks.com/topic/113201-help-with-this-code/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.