Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2019
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. <?php
  2. session_start();
  3. include'structure/head.php';
  4. include'structure/nav.php';
  5. require_once 'config.php' ;
  6. require_once 'db_class.php' ;
  7. $connection = new dbController;
  8. $connection->dbConnect(HOST,USER,PASS,DB);
  9.  
  10.  
  11. if (!isset($_POST['submit'])) {
  12. echo "Unauthorised Access";
  13. }
  14. else {
  15. $id = $_POST['carid'];
  16. $description = $_POST['description'];
  17. $caption = $_POST['caption'];
  18. $image = 'images/'.$_FILES['image']['name'];
  19. $type = $_POST['type'];
  20. $model = $_POST['model'];
  21. $colour = $_POST['colour'];
  22.  
  23. if ($_FILES['image']['error']==4) {
  24. $sql = "update cars set description='$description', caption='$caption', type='$type', model='$model', colour='$colour' where carid=$id";
  25. }
  26. else {
  27. $sql = "update cars set description='$description'', image='$image', caption='$caption', type='$type', model='$model', colour='$colour' where carid=$id";
  28. $connection->uploadImage($temp,$image);
  29. }
  30.  
  31. if($connection->insertRecord($sql)) {
  32. echo "<br><br>";
  33. echo "<b class='suc'>Successfully updated record.</b>";
  34. }
  35. else {
  36. echo "<br><br>";
  37. echo "<b class='del'>Unsuccessfully updated record.</b>";
  38. }
  39. }
  40.  
  41. include'structure/footer.php';
  42. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement