<?php
$Milg = $_POST[mileage];
$NMilg = $_POST[Nmileage];
$Mdl=$_POST[model];
$Mke=$_POST[make];
$con = mysql_connect("localhost","phpuser","phppass");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("my_cars", $con);
$queryString="UPDATE Cars SET Mileage = '$NMilg'
WHERE Model = '$Mdl' AND Make = '$Mke' AND Mileage ='$Milg'";
$queryResult = mysqli_query($con,$queryString);
if ($queryResult) {
echo "Car <b>$Mke $Mdl</b> been updated";
} else {
?>
Car not found
<form action="update.php" method="post"><br>
Make: <input name="make" type="text"/><br>
Model: <input name="model" type="text"/><br>
Old Mileage: <input name="mileage" type="text"/><br>
New Mileage:<input name="Nmileage" type="text"/><br>
<input type="Submit" value="Update" />
</form>
<?php
}
mysql_close($con);
?>
|