<?
include("../conf.php");
include(DB_INC_FILE);
$search_string_name = stripslashes($search_string_name);
// ////////////////// block of variable to change for different display SORTING methods //////////////
// Next variable is sorting method for display - Change it for different sorting methods
$order_by_field = "last_name";
// Next variable is the file name of this file
$current_file_name = "sel_by_business_name.php";
// ////////////////// end of block of variables to change //////////////////////////////////////////////
$table_name = "greg_chamblin";
$db = @mysql_select_db($db_name, $connection) or die("Couldn't select DCW Equitable database.");
$order_by_field_1 = premium;
$order_by_field_2 = business_name;
$sql = "SELECT id_num, business_name, first_name, last_name, address1, address2, city, state, zip, phone, fax, email, web_address, logo, business_type_1, business_type_2, business_type_3
FROM $table_name
WHERE business_name LIKE \"%$search_string_name%\"
ORDER BY $order_by_field_1, $order_by_field_2
";
$result = @mysql_query($sql,$connection) or die("Couldn't execute DCW Equitable Read query.");
while ($row = mysql_fetch_array($result)) {
$id_num = $row['id_num'];
$business_name = $row['business_name'];
$first_name = $row['first_name'];
$last_name = $row['last_name'];
$address1 = $row['address1'];
$address2 = $row['address2'];
$city = $row['city'];
$state = $row['state'];
$zip = $row['zip'];
$phone = $row['phone'];
$fax = $row['fax'];
$email = $row['email'];
$web_address = $row['web_address'];
$logo = $row['logo'];
$business_type_1 = $row['business_type_1'];
$business_type_2 = $row['business_type_2'];
$business_type_3 = $row['business_type_3'];
$display_block .= "
ID Number = $id_num<br>
<strong>$business_name</strong><br>
$first_name $last_name<br>
$address1<br>";
if ($address2 != "") {$display_block .= "$address2<br>";}
$display_block .= "
$city, $state $zip<br>
Phone: $phone<br>";
if ($fax != "") {$display_block .= "FAX: $fax<br>";}
if ($email != "") {$display_block .= "$email<br>";}
if ($web_address != "") {$display_block .= "$web_address<br>";}
if ($logo != "") {$display_block .= "Logo Image: $logo<br>";}
$display_block .= "
Type of Business:<br>
$business_type_1 <br>";
if ($business_type_2 != "") {$display_block .= "$business_type_2<br>";}
if ($business_type_3 != "") {$display_block .= "$business_type_3<br>";}
$display_block .= "
<form action=\"./admin_del.php\" method=\"POST\">
<input type=\"hidden\" name=\"id_num\" value=\"$id_num\">
<input type=\"hidden\" name=\"business_name\" value=\"$business_name\">
<input type=\"button\" value=\"Delete this Business\" name=\"Delete this Business\" onclick=\"checkit();\"> </form>
<form action=\"./admin_edit.php\" method=\"POST\">
<input type=\"hidden\" name=\"id_num\" value=\"$id_num\">
<input type=\"hidden\" name=\"business_name\" value=\"$business_name\">
<input type=\"submit\" value=\"Edit Data for this Business\" name=\"Edit Data for this Business\">
</form>
<hr align=\"LEFT\" size=\"2\" width=\"100%\" color=\"navy\" noshade>
";
}
?>
<html>
<head>
<script type="text/javascript">
function checkit() {
if (confirm("Are you sure you want to delete this Business?"))
{
document.getElementById("frmdefault").action = "admin_del.php";
document.getElementById("frmdefault").method="post";
document.getElementById("frmdefault").submit();
return;
}
else
{
return false;
}
}
</script>
<center><font face="Arial" size="4" color="navy"><b>Administer by Business Name</b></font></center><br>
<center><table align="center">
<tr>
<td width="3"><br></td>
<td valign="top">
<font face="Arial" size="+1" color="Black"><? echo "$display_block"; ?></font>
</td>
<td width="3"><br></td>
</tr>
</table></center>
<center><a href="./index.php">Return to Admin Menu</a></center>
<div>
<hr />
</div>
</body>
</html>