[code] <?php //ODBC CONNECTION $conn=odbc_connect('sax','',''); if (!$conn) {exit("Connection Failed: " . $conn);} //QUERY CRITERIA (VESSEL CHARACTERISTICS) $vesselchardrop=$_POST['vesselchardrop']; switch ($vesselchardrop){ case "Any"; $vesselchardrop1=""; break; case "Rim"; $vesselchardrop1="AND TblForm2.Rim>0.0"; break; case "Base"; $vesselchardrop1="AND TblForm2.Base>0.0"; break; case "Handle"; $vesselchardrop1="AND TblForm2.Handle>0.0"; break; case "Lid"; $vesselchardrop1="AND TblForm2.Lid>0.0"; break; case "Neck"; $vesselchardrop1="AND TblForm2.Neck>0.0"; break; case "Shoulder"; $vesselchardrop1="AND TblForm2.Shoulder>0.0"; break; case "Body"; $vesselchardrop1="AND TblForm2.Body>0.0"; break; } //SQL QUERY $sql="SELECT TblForm1.SotonID, TblForm1.HungID, TblForm1.Period, TblForm1.SubPeriod, TblForm1.ExcavYear, TblForm2.Rim, TblForm2.Base, TblForm2.Handle, TblForm2.Lid, TblForm2.Neck, TblForm2.Shoulder, TblForm2.Body, TblForm2.Complete, TblForm2.Conjoinable, TblForm2.SherdNo, TblForm2.vesselForm, TblForm2.VesselType, TblForm2.SherdThickness, TblForm2.SherdrimPercentage, TblForm2.SherdBaseDiameter, TblForm2.SherdBasePercentage, TblForm3.Smoothed, TblForm3.Burnished, TblForm3.Roughened, TblForm3.Rusticated, TblForm3.Decorated, TblForm3.Slip, TblForm3.Untreated, TblForm3.Impressed, TblForm3.Incised, TblForm3.Applied, TblForm3.Painted, TblForm3.Encrusted, TblForm3.FireClouding, TblForm3.Colour, TblForm3.ExtColour, TblForm3.ExtSmoothed, TblForm3.ExtBurnished, TblForm3.ExtRoughened, TblForm3.ExtRusticated, TblForm3.ExtDecorated, TblForm3.ExtSlip, TblForm3.ExtUntreated, TblForm3.ExtImpressed, TblForm3.ExtIncised, TblForm3.ExtApplied, TblForm3.ExtPainted, TblForm3.ExtEncrusted, TblForm3.ExtRibbed, TblForm3.ExtFireClouding, TblForm3.GeneralFiringConditions, TblForm3.RyeNumber, TblForm4.Hardness, TblForm4.Feel, TblForm4.Fracture, TblForm4.PrimaryInclusionPresent, TblForm4.Frequency, TblForm4.Sorting, TblForm4.Rounding, TblForm4.AverageSize, TblForm4.PrimaryInclusion, TblForm4.SecInclusionPresent, TblForm4.SecFrequency, TblForm4.SecSorting, TblForm4.SecRounding, TblForm4.SecAverageSize, TblForm4.SecInclusion, TblForm4.OtherInclusionPresent, TblForm4.OtherInclusion, TblForm5.Residue, TblForm5.Sooting, TblForm5.ReBurning, TblForm5.Abrasion, TblForm5.Limescale, TblForm5.Pitting, TblForm5.Other, TblForm5.ExtResidue, TblForm5.ExtSooting, TblForm5.ExtReBurning, TblForm5.ExtAbrasion, TblForm5.ExtLimescale, TblForm5.ExtOther, TblForm6.PhotoNumber FROM TblForm1, TblForm2, TblForm3, TblForm4, TblForm5, TblForm6 WHERE TblForm1.SotonID=TblForm2.SotonID AND TblForm1.SotonID=TblForm3.SotonID AND TblForm1.SotonID=TblForm4.SotonID AND TblForm1.SotonID=TblForm5.SotonID AND TblForm1.SotonID=TblForm6.SOtonID $vesselchardrop1 ORDER BY TblForm1.SotonID"; $rs=odbc_exec($conn,$sql); if (!$rs) {exit("Error in SQL");} //TABLE HEADINGS echo "<table><tr>"; echo "<th>SotonID</th>"; echo "<th>HungID</th>"; $periodcheck=$_POST['periodcheck']; if ($periodcheck=="on") echo "<th>Period</th><th>Sub Period</th>"; $excavyearcheck=$_POST['excavyearcheck']; if ($excavyearcheck=="on") echo "<th>Excav Year</th>"; $vesselcharacteristicscheck=$_POST['vesselcharacteristicscheck']; if ($vesselcharacteristicscheck=="on") echo "<th>Vessel Characteristics</th><th>Vessel Form</th><th>Vessel Type</th>"; $completecheck=$_POST['completecheck']; if ($completecheck=="on") echo "<th>Complete</th>"; $conjoinablecheck=$_POST['conjoinablecheck']; if ($conjoinablecheck=="on") echo "<th>Conjoinable</th>"; $sherddetailscheck=$_POST['sherddetailscheck']; if ($sherddetailscheck=="on") echo "<th>Sherd No.</th> <th>Sherd Thickness</th> <th>Sherd Rim %</th> <th>Sherd Base Diameter</th> <th>Sherd Base %</th>"; $intdecorationcheck=$_POST['intdecorationcheck']; if ($intdecorationcheck=="on") echo "<th>Interior Decoration</th> <th>Interior Colour</th>"; $extdecorationcheck=$_POST['extdecorationcheck']; if ($extdecorationcheck=="on") echo "<th>Exterior Decoration</th> <th>Exterior Colour</th>"; $firingconditionscheck=$_POST['firingconditionscheck']; if ($firingconditionscheck=="on") echo "<th>Firing Conditions</th>"; $ryenumbercheck=$_POST['ryenumbercheck']; if ($ryenumbercheck=="on") echo "<th>Rye Number</th>"; $hardnesscheck=$_POST['hardnesscheck']; if ($hardnesscheck=="on") echo "<th>Hardness</th>"; $feelcheck=$_POST['feelcheck']; if ($feelcheck=="on") echo "<th>Feel</th>"; $fracturecheck=$_POST['fracturecheck']; if ($fracturecheck=="on") echo "<th>Fracture</th>"; $primaryinclusioncheck=$_POST['primaryinclusioncheck']; if ($primaryinclusioncheck=="on") echo "<th>Primary Inclusion Present</th> <th>Primary Inclusion Frequency</th> <th>Primary Inclusion Sorting</th> <th>Primary Inclusion Rounding</th> <th>Primary Inclusion Average Size</th> <th>Primary Inclusion Notes</th>"; $secondaryinclusioncheck=$_POST['secondaryinclusioncheck']; if ($secondaryinclusioncheck=="on") echo "<th>Secondary Inclusion Present</th> <th>Secondary Frequency</th> <th>Secondary Sorting</th> <th>Secondary Rounding</th> <th>Secondary Average Size</th> <th>Secondary Inclusion Notes</th>"; $otherinclusioncheck=$_POST['otherinclusioncheck']; if ($otherinclusioncheck=="on") echo "<th>Other Inclusion Present</th> <th>Other Inclusion Notes</th>"; $intusewearcheck=$_POST['intusewearcheck']; if ($intusewearcheck=="on") echo "<th>Interior Use Wear</th>"; $extusewearcheck=$_POST['extusewearcheck']; if ($extusewearcheck=="on") echo "<th>Exterior Use Wear</th>"; $photocheck=$_POST['photocheck']; if ($photocheck=="on") echo "<th>Photo</th>"; echo "</tr>"; while (odbc_fetch_row($rs)) { //RESULTS VARIABLES $sotonid=odbc_result($rs,"SotonID"); $hungid=odbc_result($rs,"HungID"); $period=odbc_result($rs,"Period"); $subperiod=odbc_result($rs,"SubPeriod"); $excavyear=odbc_result($rs,"ExcavYear"); $complete=odbc_result($rs,"Complete"); $conjoinable=odbc_result($rs,"Conjoinable"); $sherdno=odbc_result($rs,"SherdNo"); $vesselform=odbc_result($rs,"VesselForm"); $vesseltype=odbc_result($rs,"VesselType"); $sherdthickness=odbc_result($rs,"SherdThickness"); $sherdrimpercentage=odbc_result($rs,"SherdRimPercentage"); $sherdbasediameter=odbc_result($rs,"SherdBaseDiameter"); $sherdbasepercentage=odbc_result($rs,"SherdBasePercentage"); $interiorcolour=odbc_result($rs,"Colour"); $extcolour=odbc_result($rs,"ExtColour"); $firingconditions=odbc_result($rs,"GeneralFiringConditions"); $ryenumber=odbc_result($rs,"RyeNumber"); $hardness=odbc_result($rs,"Hardness"); $feel=odbc_result($rs,"Feel"); $fracture=odbc_result($rs,"Fracture"); $primaryinclusionpresent=odbc_result($rs,"PrimaryInclusionPresent"); $frequency=odbc_result($rs,"Frequency"); $sorting=odbc_result($rs,"Sorting"); $rounding=odbc_result($rs,"Rounding"); $averagesize=odbc_result($rs,"AverageSize"); $primaryinclusionnotes=odbc_result($rs,"PrimaryInclusion"); $secinclusionpresent=odbc_result($rs,"SecInclusionPresent"); $secfrequency=odbc_result($rs,"SecFrequency"); $secsorting=odbc_result($rs,"SecSorting"); $secrounding=odbc_result($rs,"SecRounding"); $secaveragesize=odbc_result($rs,"SecAverageSize"); $secinclusionnotes=odbc_result($rs,"SecInclusion"); $otherinclusionpresent=odbc_result($rs,"OtherInclusionPresent"); $otherinclusionnotes=odbc_result($rs,"OtherInclusion"); $photo=odbc_result($rs,"PhotoNumber"); //VESSEL CHARACTERISTICS CONDITIONS $rim=odbc_result($rs,"Rim"); $base=odbc_result($rs,"Base"); $handle=odbc_result($rs,"Handle"); $lid=odbc_result($rs,"Lid"); $neck=odbc_result($rs,"Neck"); $shoulder=odbc_result($rs,"Shoulder"); $body=odbc_result($rs,"Body"); if ($rim=="0.0") $rim1=""; else $rim1="Rim,"; if ($base=="0.0") $base1=""; else $base1="Base,"; if ($handle=="0.0") $handle1=""; else $handle1="Handle,"; if ($lid=="0.0") $lid1=""; else $lid1="Lid,"; if ($neck=="0.0") $neck1=""; else $neck1="Neck,"; if ($shoulder=="0.0") $shoulder1=""; else $shoulder1="Shoulder,"; if ($body=="0.0") $body1=""; else $body1="Body,"; //INTERIOR DECORATION $smoothed=odbc_result($rs,"Smoothed"); $burnished=odbc_result($rs,"Burnished"); $roughened=odbc_result($rs,"Roughened"); $rusticated=odbc_result($rs,"Rusticated"); $decorated=odbc_result($rs,"Decorated"); $slip=odbc_result($rs,"Slip"); $untreated=odbc_result($rs,"Untreated"); $impressed=odbc_result($rs,"Impressed"); $incised=odbc_result($rs,"Incised"); $applied=odbc_result($rs,"Applied"); $painted=odbc_result($rs,"Painted"); $encrusted=odbc_result($rs,"Encrusted"); $fireclouding=odbc_result($rs,"FireClouding"); if ($smoothed=="0") $smoothed1=""; else $smoothed1="Smoothed,"; if ($burnished=="0") $burnished1=""; else $burnished1="Burnished,"; if ($roughened=="0") $roughened1=""; else $roughened1="Roughened,"; if ($rusticated=="0") $rusticated1=""; else $rusticated1="Rusticated,"; if ($decorated=="0") $decorated1=""; else $decorated1="Decorated,"; if ($slip=="0") $slip1=""; else $slip1="Slip,"; if ($untreated=="0") $untreated1=""; else $untreated1="Untreated,"; if ($impressed=="0") $impressed1=""; else $impressed1="Impressed,"; if ($incised=="0") $incised1=""; else $incised1="Incised,"; if ($applied=="0") $applied1=""; else $applied1="Applied,"; if ($painted=="0") $painted1=""; else $painted1="Painted,"; if ($encrusted=="0") $encrusted1=""; else $encrusted1="Encrusted,"; if ($fireclouding=="0") $fireclouding1=""; else $fireclouding1="Fire Clouding,"; //EXTERIOR DECORATION $extsmoothed=odbc_result($rs,"Smoothed"); $extburnished=odbc_result($rs,"Burnished"); $extroughened=odbc_result($rs,"Roughened"); $extrusticated=odbc_result($rs,"Rusticated"); $extdecorated=odbc_result($rs,"Decorated"); $extslip=odbc_result($rs,"Slip"); $extuntreated=odbc_result($rs,"Untreated"); $extimpressed=odbc_result($rs,"Impressed"); $extincised=odbc_result($rs,"Incised"); $extapplied=odbc_result($rs,"Applied"); $extpainted=odbc_result($rs,"Painted"); $extencrusted=odbc_result($rs,"Encrusted"); $extribbed=odbc_result($rs,"Ribbed"); $extfireclouding=odbc_result($rs,"FireClouding"); if ($extsmoothed=="0") $extsmoothed1=""; else $extsmoothed1="Smoothed,"; if ($extburnished=="0") $extburnished1=""; else $extburnished1="Burnished,"; if ($extroughened=="0") $extroughened1=""; else $extroughened1="Roughened,"; if ($extrusticated=="0") $extrusticated1=""; else $extrusticated1="Rusticated,"; if ($extdecorated=="0") $extdecorated1=""; else $extdecorated1="Decorated,"; if ($extslip=="0") $extslip1=""; else $extslip1="Slip,"; if ($extuntreated=="0") $extuntreated1=""; else $extuntreated1="Untreated,"; if ($extimpressed=="0") $extimpressed1=""; else $extimpressed1="Impressed,"; if ($extincised=="0") $extincised1=""; else $extincised1="Incised,"; if ($extapplied=="0") $extapplied1=""; else $extapplied1="Applied,"; if ($extpainted=="0") $extpainted1=""; else $extpainted1="Painted,"; if ($extencrusted=="0") $extencrusted1=""; else $extencrusted1="Encrusted,"; if ($extribbed=="0") $extribbed1=""; else $extribbed1="Ribbed,"; if ($extfireclouding=="0") $extfireclouding1=""; else $extfireclouding1="Fire Clouding,"; //INTERIOR USE WEAR $residue=odbc_result($rs,"Residue"); $sooting=odbc_result($rs,"Sooting"); $reburning=odbc_result($rs,"ReBurning"); $abrasion=odbc_result($rs,"Abrasion"); $limescale=odbc_result($rs,"Limescale"); $pitting=odbc_result($rs,"Pitting"); $other=odbc_result($rs,"Other"); if ($residue=="1") $residue1="Residue,"; else $residue1=""; if ($sooting=="1") $sooting1="Sooting, "; else $sooting1=""; if ($reburning=="1") $reburning1="Reburning,"; else $reburning1=""; if ($abrasion=="1") $abrasion1="Abrasion,"; else $abrasion1=""; if ($limescale=="1") $limescale1="Limescale"; else $limescale1=""; if ($pitting=="1") $pitting1="Pitting"; else $pitting1=""; //EXTERIOR USE WEAR $extresidue=odbc_result($rs,"ExtResidue"); $extsooting=odbc_result($rs,"ExtSooting"); $extreburning=odbc_result($rs,"ExtReBurning"); $extabrasion=odbc_result($rs,"ExtAbrasion"); $extlimescale=odbc_result($rs,"ExtLimescale"); $extpitting=odbc_result($rs,"ExtPitting"); $extother=odbc_result($rs,"ExtOther"); if ($extresidue=="1") $extresidue1="Residue,"; else $extresidue1=""; if ($extsooting=="1") $extsooting1="Sooting, "; else $extsooting1=""; if ($extreburning=="1") $extreburning1="Reburning,"; else $extreburning1=""; if ($extabrasion=="1") $extabrasion1="Abrasion,"; else $extabrasion1=""; if ($extlimescale=="1") $extlimescale1="Limescale"; else $extlimescale1=""; //OTHER VARIABLE CONDITIONS if ($complete=="1") $complete1="Yes"; else $complete1="No"; if ($primaryinclusionpresent=="1") $primaryinclusionpresent1="Yes"; else $primaryinclusionpresent1="No"; if ($secinclusionpresent=="1") $secinclusionpresent1="Yes"; else $secinclusionpresent1="No"; //TABLE OUTPUT echo "<tr><td>$sotonid</td>"; echo "<td>$hungid</td>"; $periodcheck=$_POST['periodcheck']; if ($periodcheck=="on") echo "<td>$period</td><td>$subperiod</td>"; $excavyearcheck=$_POST['excavyearcheck']; if ($excavyearcheck=="on") echo "<td>$excavyear</td>"; $vesselcharacteristicscheck=$_POST['vesselcharacteristicscheck']; if ($vesselcharacteristicscheck=="on") echo "<td>$rim1 $base1 $handle1 $lid1 $neck1 $shoulder1 $body1</td><td>$vesselform</td><td>$vesseltype</td>"; $completecheck=$_POST['completecheck']; if ($completecheck=="on") echo "<td>$complete1</td>"; $conjoinablecheck=$_POST['conjoinablecheck']; if ($conjoinablecheck=="on") echo "<td>$conjoinable</td>"; $sherddetailscheck=$_POST['sherddetailscheck']; if ($sherddetailscheck=="on") echo "<td>$sherdno</td> <td>$sherdthickness</td> <td>$sherdrimpercentage</td> <td>$sherdbasediameter</td> <td>$sherdbasepercentage</td>"; $intdecorationcheck=$_POST['intdecorationcheck']; if ($intdecorationcheck=="on") echo "<td>$smoothed1 $burnished1 $roughened1 $rusticated1 $decorated1 $slip1 $untreated1 $impressed1 $incised1 $applied1 $painted1 $encrusted1 $fireclouding1</td> <td>$interiorcolour</td>"; $extdecorationcheck=$_POST['extdecorationcheck']; if ($extdecorationcheck=="on") echo "<td>$extsmoothed1 $extburnished1 $extroughened1 $extrusticated1 $extdecorated1 $extslip1 $extuntreated1 $extimpressed1 $extincised1 $extapplied1 $extpainted1 $extencrusted1 $extribbed $extfireclouding1</td> <td>$extcolour</td>"; $firingconditionscheck=$_POST['firingconditionscheck']; if ($firingconditionscheck=="on") echo "<td>$firingconditions</td>"; $ryenumbercheck=$_POST['ryenumbercheck']; if ($ryenumbercheck=="on") echo "<td>$ryenumber</td>"; $hardnesscheck=$_POST['hardnesscheck']; if ($hardnesscheck=="on") echo "<td>$hardness</td>"; $feelcheck=$_POST['feelcheck']; if ($feelcheck=="on") echo "<td>$feel</td>"; $fracturecheck=$_POST['fracturecheck']; if ($fracturecheck=="on") echo "<td>$fracture</td>"; $primaryinclusioncheck=$_POST['primaryinclusioncheck']; if ($primaryinclusioncheck=="on") echo "<td>$primaryinclusionpresent1</td> <td>$frequency</td> <td>$sorting</td> <td>$rounding</td> <td>$averagesize</td> <td>$primaryinclusionnotes</td>"; $secondaryinclusioncheck=$_POST['secondaryinclusioncheck']; if ($secondaryinclusioncheck=="on") echo "<td>$secinclusionpresent1</td> <td>$secfrequency</td> <td>$secsorting</td> <td>$secrounding</td> <td>$secaveragesize</td> <td>$secinclusionnotes</td>"; $otherinclusioncheck=$_POST['otherinclusioncheck']; if ($otherinclusioncheck=="on") echo "<td>$otherinclusionpresent</td> <td>$otherinclusionnotes</td>"; $intusewearcheck=$_POST['intusewearcheck']; if ($intusewearcheck=="on") echo "<td>$residue1 $sooting1 $reburning1 $abrasion1 $limescale1 $pitting1 $other</td>"; $extusewearcheck=$_POST['extusewearcheck']; if ($extusewearcheck=="on") echo "<td>$extresidue1 $extsooting1 $extreburning1 $extabrasion1 $extlimescale1 $extother</td>"; $photocheck=$_POST['photocheck']; if ($photocheck=="on") echo "<td><a href=dbimages/$photo target=new>$photo</a></td>"; echo "</tr>"; } odbc_close($conn); echo "</table>"; ?> [/code]