asked on
ASKER
ASKER
ASKER
<?php
// declare all my variables
$cost = $_POST['costs'];
$time = $_POST['time'];
$leg = $_POST['leg'];
$people = $_POST['people'];
$employee = $_POST['employee'];
$training = $_POST['training'];
$change = $_POST['change'];
$season = $_POST['season'];
// set all the conditions to send to mySQL
$filter = "";
if ($cost != 0) {
$filter .= "tblbiz.bCosts = " .$cost. "'";
$sel = "tblbiz.bCosts";
}
// if $costs is selected check to see if $time has a value
if ($time != 0) {
if(isset($cost)&&($cost != 0)){
$sel .= "tblbiz.bTime";
$filter .= "AND";
}
$filter .= "tblbiz.bTime = '".$time."'";
}
// if $costs, $time is selected check to see if $leg is selected (business legitmacy)
if ($leg != 0) {
if(isset($cost)&&($cost != 0)||isset($time)&&($time != 0)) {
$sel .= "tblbiz.bLeg";
$filter .= "AND";
}
$filter .= "tblbiz.bLeg = '".$leg."'";
}
$sql = "SELECT tblbiz.bname $sel WHERE $filter";
mysql_query($sql)
or die('an error occured:' .mysql_error());
$count = mysql_num_rows($sql);
<?php
// declare all my variables
$cost = $_POST['costs'];
$time = $_POST['time'];
$leg = $_POST['leg'];
$people = $_POST['people'];
$employee = $_POST['employee'];
$training = $_POST['training'];
$change = $_POST['change'];
$season = $_POST['season'];
// set all the conditions to send to mySQL
$filter = "";
if ($cost != 0) {
$filter .= "tblbiz.bCosts = " .$cost. "'";
$sel = "tblbiz.bCosts";
}
// if $costs is selected check to see if $time has a value
if ($time != 0) {
if(isset($cost)&&($cost != 0)){
$sel .= "tblbiz.bTime";
$filter .= "AND";
}
$filter .= "tblbiz.bTime = '".$time."'";
}
// if $costs, $time is selected check to see if $leg is selected (business legitmacy)
if ($leg != 0) {
if(isset($cost)&&($cost != 0)||isset($time)&&($time != 0)) {
$sel .= "tblbiz.bLeg";
$filter .= "AND";
}
$filter .= "tblbiz.bLeg = '".$leg."'";
}
$sql = "SELECT tblbiz.bname $sel WHERE $filter";
mysql_query($sql)
or die('an error occured:' .mysql_error());
$count = mysql_num_rows($sql);
<?php include_once ('sql.php'); ?>
<?php echo $row['tblbiz.bName']; ?>
ASKER
ASKER
<?php
// refine database query
// declare all my variables
if (isset ($_POST['time'])){
$time = $_POST['time'];}
if (isset ($_POST['leg'])){
$leg = $_POST['leg'];}
if (isset ($_POST['people'])){
$people = $_POST['people'];}
if (isset ($_POST['employee'])){
$employee = $_POST['employee'];}
if (isset ($_POST['training'])){
$training = $_POST['training'];}
if (isset ($_POST['change'])){
$change = $_POST['change'];}
if (isset ($_POST['season'])){
$season = $_POST['season'];}
// build the query
if (isset($_POST['button'])){
$filter = "";
if ($time != 0) {
$filter .= " AND tblbiz.bTime = " .$time. "'";
}
if ($leg != 0) {
$filter .= " AND tblbiz.bLeg = " .$leg. "'";
}
if ($people != 0) {
$filter .= " AND tblbiz.bCon = " .$people. "'";
}
if ($employee != 0) {
$filter .= " AND tblbiz.bEmp = " .$employee. "'";
}
if ($training != 0) {
$filter .= " AND tblbiz.bTra = " .$training. "'";
}
if ($change != 0) {
$filter .= "AND tblbiz.bCha = " .$change. "'";
}
if ($season != 0) {
$filter .= "AND tblbiz.bSea = " .$season. "'";
}
mysql_select_db($database_con_search, $con_search);
$query_rs_refsel = sprintf("SELECT tblbiz.bName WHERE 1=1 $filter",
GetSQLValueString($time, "int"),
GetSQLValueString($leg, "int"),
GetSQLValueString($people, "int"),
GetSQLValueString($employee, "int"),
GetSQLValueString($training, "int"),
GetSQLValueString($change, "int"),
GetSQLValueString($season, "int"));
$rs_refsel = mysql_query($query_rs_refsel, $con_search) or die(mysql_error());
$row_rs_refsel = mysql_fetch_assoc($rs_refsel);
$totalRows_rs_refsel = mysql_num_rows($rs_refsel);
}
?>
if (isset ($_POST['time'])){
$time = $_POST['time'];}
$time variable will not be defined if $_POST['time'] was not defined.$time = 0;
if (isset ($_POST['time'])){
$time = $_POST['time'];}
ASKER
ASKER
<?php if (isset($_POST['Submit'])){
// refine database query
// declare all my variables
$costs = $_GET['costs'];
$time = 0;
if (isset ($_POST['time'])){
$time = $_POST['time'];}
$leg = 0;
if (isset ($_GET['leg'])){
$leg = $_GET['leg'];}
$people = 0;
if (isset ($_POST['people'])){
$people = $_POST['people'];}
$employee = 0;
if (isset ($_POST['employee'])){
$employee = $_POST['employee'];}
$training = 0;
if (isset ($_POST['training'])){
$training = $_POST['training'];}
$change = 0;
if (isset ($_POST['change'])){
$change = $_POST['change'];}
$season = 0;
if (isset ($_POST['season'])){
$season = $_POST['season'];}
// build the query
$filter = "tblbiz.bCosts = " .$costs. "'";
if ($time != 0) {
$filter .= " AND tblbiz.bTime = " .$time. "'";
}
if ($leg != 0) {
$filter .= " AND tblbiz.bLeg = " .$leg. "'";
}
if ($people != 0) {
$filter .= " AND tblbiz.bCon = " .$people. "'";
}
if ($employee != 0) {
$filter .= " AND tblbiz.bEmp = " .$employee. "'";
}
if ($training != 0) {
$filter .= " AND tblbiz.bTra = " .$training. "'";
}
if ($change != 0) {
$filter .= "AND tblbiz.bCha = " .$change. "'";
}
if ($season != 0) {
$filter .= "AND tblbiz.bSea = " .$season. "'";
}
mysql_select_db($database_con_search, $con_search);
$query_rs_refsel = sprintf("SELECT tblbiz.bName WHERE 1=1 $filter",
GetSQLValueString($time, "int"),
GetSQLValueString($leg, "int"),
GetSQLValueString($people, "int"),
GetSQLValueString($employee, "int"),
GetSQLValueString($training, "int"),
GetSQLValueString($change, "int"),
GetSQLValueString($season, "int"));
$rs_refsel = mysql_query($query_rs_refsel, $con_search) or die(mysql_error());
$row_rs_refsel = mysql_fetch_assoc($rs_refsel);
$totalRows_rs_refsel = mysql_num_rows($rs_refsel);
ASKER
Databases are organized collections of data, most commonly accessed through management systems including schemas, tables, queries and processes that allow users to enter and manipulate the information or utilize it in other fashions, such as with web applications or for reporting purposes.
TRUSTED BY
HTH,
Kent