<?php
//--------------------------------------------------------------------
// INITIALIZING VARIABLES
$hostname = "localhost";
$username = "root";
$password = "mastercut";
$dbname = "mastercut";
$usertable = "tblburs";
//--------------------------------------------------------------------------
// CONNECTION TO DATABASE
mysql_connect($hostname,$username,$password) or die("Unable to connect to database");
mysql_select_db($dbname) or die("Unable to select database");
// REASSIGNING EMPTY VARIABLES TO WILDCARDS
//-------------------------------------------------------------------------
if(empty($radio)){
$radio = '%';
}
//-------------------------------------------------------------------------
if(empty($partnum)){
$partnum = '%';
}
//-------------------------------------------------------------------------
if(empty($diameter)){
$diameter = '%';
}
//-------------------------------------------------------------------------
if(empty($cel)){
$cel = '%';
}
//-------------------------------------------------------------------------
if(empty($shank)){
$shank = '%';
}
//------------------------------------------------------------------------
if(empty($oal)){
$oal = '%';
}
//-------------------------------------------------------------------------
// NO IF STATEMENT NEEDED FOR LAST TWO FORM VARIABLES THEY ARE ASSIGNED BY THE DROP DOWN
//-------------------------------------------------------------------------
//QUERYING DATABASE FOR RECORDS
$result = mysql_query("SELECT * FROM tblburs WHERE
tblburs.units LIKE '$radio' AND
tblburs.partnumber LIKE '$partnum' AND
tblburs.diameter LIKE '$diameter' AND
tblburs.LOC LIKE '$cel' AND
tblburs.shank LIKE '$shank' AND
tblburs.oal LIKE '$oal' AND
tblburs.type LIKE '$shape' AND
tblburs.cuttype LIKE '$cuttype'");
$number = mysql_num_rows($result);
// SETTING UP TABLE HEADS
?>
<table width="757" border="1">
<tr>
<th scope="col"> </th>
<th scope="col"> </th>
<th scope="col"> </th>
<th colspan="4" scope="col" bgcolor="#0066FF"><span class="style3">Dimensions</span></th>
<th scope="col"> </th>
<tr>
<th scope="col" bgcolor="#0066FF"><span class="style3">Bur Type</span></th>
<th scope="col" bgcolor="#0066FF"><span class="style3">Cut Type </span></th>
<th scope="col" bgcolor="#0066FF"><span class="style3">Part Number </span></th>
<th scope="col" bgcolor="#0066FF"><span class="style3">Out. Dia</span></th>
<th scope="col" bgcolor="#0066FF"><span class="style3">Length Of Cut </span></th>
<th scope="col" bgcolor="#0066FF"><span class="style3">Shank Dia. </span></th>
<th scope="col" bgcolor="#0066FF"><span class="style3">Overall Length </span></th>
<th scope="col" bgcolor="#0066FF"><span class="style3">Price</span></th>
<?php
$i = 0;
if($number == 0){
print "<center>No Parts Found</center>";
}
elseif ($number > 0){
print "<center>Burs Found Matching Your Query: $number</center><BR>";
while ($i < $number):
?>
<tr>
<th><span class="style3">
<?php
$burtype = mysql_result($result,$i,"burtype");
print "$burtype";
?></span></th>
<th><span class="style3">
<?php
$cuttype = mysql_result($result,$i,"CutType");
print "$cuttype";
?></span></th>
<th><span class="style3">
<?php
$partnum = mysql_result($result,$i,"PartNumber");
print "$partnum";
?></span></th>
<th><span class="style3">
<?php
$diameter = mysql_result($result,$i,"Diameter");
print "$diameter";
?></span></th>
<th><span class="style3">
<?php
$cel = mysql_result($result,$i,"LOC");
print "$cel";
?></span></th>
<th><span class="style3">
<?php
$shank = mysql_result($result,$i,"Shank");
print "$shank";
?></span></th>
<th><span class="style3">
<?php
$oal = mysql_result($result,$i,"oal");
print "$oal";
?></span></th>
<th><span class="style3">
<?php
$list = mysql_result($result,$i,"list");
print "$list";
?></span></th>
<?php
$i++;
endwhile;
}
?>
</table>
</html>
Yes I admit it took awhile.
But it is all working as designed, Thank You for all your help.
I got a good big cup o' joe and banged it out.
Broc7 you were right about the single quotes for text based queries.
Thanks,
Shane