Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/local/bin/php
- <?php
- $uVIN = $_GET['VIN'];
- //echo $uVIN;
- $uMake = $_GET['MAN'];
- //echo $uMake;
- $uModel = $_GET['MON'];
- //echo $uModel;
- $uYear = $_GET['Y'];
- //echo $uYear;
- $uMPG = $_GET['MPG'];
- //echo $uMPG;
- $uTrans = $_GET['T'];
- //echo $uTrans;
- $uCondition = $_GET['C'];
- //echo $uCondition;
- $uMiles = $_GET['MILES'];
- //echo $uMiles;
- $uIncidents = $_GET['I'];
- //echo $uIncidents;
- $uOwners = $_GET['NO'];
- //echo $uOwners;
- $uCost = $_GET['COST'];
- //echo $uCost;
- $uColor = $_GET['COLOR'];
- //echo $uColor;
- $uState = $_GET['STATE'];
- //echo $uState;
- $uRegion = $_GET['REGION'];
- //echo $uRegion;
- ?>
- <?php
- //Script for adding VIN to currentUserFavorites
- $connection = oci_connect($username = '*******',
- $password = '*************',
- $connection_string = '//oracle.cise.ufl.edu/orcl');
- //Test to see if seperate php block can echo variable from php block above
- echo "Lower VIN Test";
- echo $uVIN;
- //Retrive current user. Store as $uname
- $loginpls = oci_parse($connection, "SELECT * FROM currentUser");
- oci_execute($loginpls);
- $row = oci_fetch_array($loginpls);
- $uname = $row[0];
- oci_free_statement($loginpls);
- //Check to see if vehicle is already in favorites or current user
- $favBool = oci_parse($connection, "Select case when favusername is NULL then '0' else '1' end from FAVORITES where favusername = '$uname' and favvin = '$uVIN'");
- oci_execute($favBool);
- $test = oci_fetch_array($favBool);
- echo $uVIN;
- echo $uname;
- //Should echo a 1 if vehicle is already in current user's favorites WORKING!
- //echo "$test[0]";
- oci_free_statement($favBool);
- //Checks to see if VIN is already in user's favorites
- if ($test[0] != 1){
- $addFav = oci_parse($connection, "Insert into Favorites(favusername, favvin) VALUES ('$uname', '$uVIN')");
- oci_execute($addFav);
- echo "Attempted to execute favoriting";
- }
- oci_close($connection);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement