Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/local/bin/php
- <?php
- $connection = oci_connect($username = '******',
- $password = '******',
- $connection_string = '//oracle.cise.ufl.edu/orcl');
- $model = $_POST["model"];
- $make = $_POST["make"];
- $year = $_POST["year"];
- $HImpg = $_POST["HImpg"];
- $LOmpg = $_POST["LOmpg"];
- $transmission = $_POST["Transmission"];
- $HImiles = $_POST["HImiles"];
- $LOmiles = $_POST["LOmiles"];
- $HIincidents = $_POST["HIincidents"];
- $LOincidents = $_POST["LOincidents"];
- $HInumOwners = $_POST["HInumOwners"];
- $LOnumOwners = $_POST["LOnumOwners"];
- $HIcost = $_POST["HIcost"];
- $LOcost = $_POST["LOcost"];
- $color = $_POST["color"];
- $state = $_POST["state"];
- $region = $_POST["region"];
- $HIcondition = $_POST["HIcondition"];
- $LOcondition = $_POST["LOcondition"];
- $select = "SELECT * ";
- $from = "FROM vehicle ";
- $where = "WHERE";
- $count = 0;
- echo $HImpg."\n" ;
- echo $LOmpg;
- if($make!=""){
- $where .= " make_name = '$make'";
- $count+=1;
- }
- if($model!=""){
- if($count>0){
- $where .= " AND";
- }
- $where .= " model_name = '$model'";
- $count+=1;
- }if($transmission!=""){
- if($count>0){
- $where .= " AND";
- }
- $where .= " TRANSMISSION = '$transmission'";
- $count+=1;
- }
- if($HImiles>$LOmiles){
- if($count>0){
- $where .= " AND";
- }
- $where .= " MILES >= $LOmiles AND MILES <= $HImiles";
- $count+=1;
- }
- if($HIincidents>$LOincidents){
- if($count>0){
- $where .= " AND";
- }
- $where .= " INCIDENTS >= $LOincidents AND INCIDENTS <= $HIincidents";
- $count+=1;
- }
- if($year!=""){
- if($count>0){
- $where .= " AND";
- }
- $where .= " YEAR = $year";
- $count+=1;
- }
- if($HImpg>$LOmpg){
- if($count>0){
- $where .= " AND";
- }
- $where .= " MPG >= $LOmpg AND MPG <= $HImpg";
- $count+=1;
- }
- if($color!=""){
- if($count>0){
- $where .= " AND";
- }
- $where .= " color = '$color'";
- $count+=1;
- }
- if($state!=""){
- if($count>0){
- $where .= " AND";
- }
- $where .= " STATE = '$state'";
- $count+=1;
- }
- if($HIcondition>$LOcondition){
- if($count>0){
- $where .= " AND";
- }
- $where .= " CONDITION >= $LOcondition AND CONDITION <= $HIcondition";
- $count+=1;
- }
- if($HInumOwners>$LOnumOwners){
- if($count>0){
- $where .= " AND";
- }
- $where .= " NUMBER_OWNERS >= $LOnumOwners AND NUMBER_OWNERS <= $HInumOwners";
- $count+=1;
- }
- if($HIcost>$LOcost){
- if($count>0){
- $where .= " AND";
- }
- $where .= " COST >= $LOcost AND COST <= $HIcost";
- $count+=1;
- }
- if($region!=""){
- if($count>0){
- $where .= " AND";
- }
- $where .= " REGION = '$region'";
- $count+=1;
- }
- $query = "{$select}{$from}{$where}";
- echo $query;
- /*else {
- $query = "{$select}{$from}"select}{$from}{$where}";
- }*/
- $statement = oci_parse($connection, $query);
- oci_execute($statement);
- print "<table border='1'>\n";
- while ($row = oci_fetch_array($statement, OCI_ASSOC+OCI_RETURN_NULLS)) {
- print "<tr> \n";
- echo "<td> <a href=details.php?VIN=$row[VIN]&MAN=$row[MAKE_NAME]&MON=$row[MODEL_NAME]&Y=$row[YEAR]&MPG=$row[MPG]&T=$row[TRANSMISSION]&C=$row[CONDITION]&MILES=$row[MILES]&I=$row[INCIDENTS]&NO=$row[NUMBER_OWNERS]&COST=$row[COST]&COLOR=$row[COLOR]&STATE=$row[STATE]®ION=$row[REGION]>Details </a> </td>";
- foreach ($row as $item) {
- echo " <td>" .($item !== null ? htmlentities($item, ENT_QUOTES) : " ") . " </a></td>\n";
- }
- print " </tr>\n";
- }
- print "</table>\n";
- $statement = oci_parse($connection, $query);
- oci_execute($statement);
- /*
- while ($row = oci_fetch_array($statement) {
- echo "hi";
- //echo "<a href = "details.php">" .$row['VIN']"</a>";
- };
- */
- //
- // VERY important to close Oracle Database Connections and free statements!
- //
- oci_free_statement($statement);
- oci_close($connection);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement