I have a Batch Action that makes a datasheet from a table view that has several lookup fields which display at present there id's. "Red circles"
here is my code;
Code: Select all
<?php
$curr_dir = dirname(__FILE__);
include("{$curr_dir}/defaultLang.php");
include("{$curr_dir}/language.php");
include("{$curr_dir}/lib.php");
$table = $_REQUEST['table'];
$ids = $_REQUEST['ids'];
$cs_ids = '';
foreach($ids as $id){
$cs_ids .= "'" . makeSafe($id) . "',";
}
$cs_ids = substr($cs_ids, 0, -1);
$res = sql( "select * from marriage " .
"where id in ({$cs_ids})", $eo);
while($row = db_fetch_assoc($res)){
?>
<link rel="stylesheet" href="table.css">
<div class="divTable" style="width:100%">
<div class="divTableBody">
<div class="divTableRow">
<div class="divTableCell"> <i><font size="4"><b>Clan MacLellan Marriage Datasheet for ➤ <u><?php echo $row['forename']; ?> <?php echo $row['surname']; ?></u></b></font></i> <!--surname is a lookup from table surname, column id.-->
<br>
<br> <i><b>Year ➤ </b><u><?php echo $row['year']; ?></u></i>
<br> <i><b>Gender ➤ </b><u><?php echo $row['gender']; ?></u></i>
<br> <i><b>Surname ➤ </b><u><?php echo $row['surname']; ?></u></i> <!--surname is a lookup from table surname, column id-->
<br> <i><b>First Name ➤ </b><u><?php echo $row['forename']; ?></u></i>
<br> <i><b>Spouse Surname ➤ </b><u><?php echo $row['spouse_surname']; ?></u></i>
<br> <i><b>Spouse Forename ➤ </b><u><?php echo $row['spouse_forename']; ?></u></i>
<br> <i><b>Marriage Date ➤ </b><u><?php echo $row['marriage_date']; ?></u></i>
<br> <i><b>2nd Marriage ➤ </b><u><?php echo $row['marriage_2']; ?></u></i> <!--2nd Marriage is a lookup from table other_marriages, column id-->
<br> <i><b>3rd Marriage ➤ </b><u><?php echo $row['marriage_3']; ?></u></i> <!--3rd Marriage is a lookup from table other_marriages, column id-->
<br> <i><b>4th Marriage ➤ </b><u><?php echo $row['marriage_4']; ?></u></i> <!--4th Marriage is a lookup from table other_marriages, column id-->
<br> <i><b>Parish or County ➤ </b><u><?php echo $row['parish_county']; ?></u></i>
<br> <i><b>Country ➤ </b><u><?php echo $row['country']; ?></u></i>
<br> <i><b>Family File Number ➤ </b><u><?php echo $row['ff_number']; ?></u></i> <!--ff_number is a lookup from table ff_number, column id-->
<br> <i><b>Comments ➤</b><div class="trim"><?php echo $row['comments']; ?></div></i>
<br>
<br>
<div style="width: 100%; height: 20px; border-bottom: 1px solid black; text-align: center"> <span style="font-size: 18px; background-color: #F3F5F6; padding: 0 10px;">End of data sheet.</span></div>
<div class="footer"><img src="hooks/images/CM_ThinkOn.png"></div>
</div>
</div>
</div>
</div>
<?php
}
problem is several fields are lookups to different tables and are represented by there id's and I need to display the text.
How do I switch to another table pull the id information, switch back to main table, switch to 3rd table pull id information, switch back and so on.
Can it even be done?