Advertisement
Guest User

Untitled

a guest
Mar 3rd, 2019
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.55 KB | None | 0 0
  1. $host="localhost";
  2. $username="root";
  3. $password="sunbuggy";
  4. $database="mpg";
  5. $table="m";
  6.  
  7. mysql_connect($host,$username,$password) or die( "unable to connect to mysql server");
  8. mysql_select_db($database) or die( "Unable to select database");
  9.  
  10. $driver=$_POST['driver'];
  11. $shuttle=$_POST['shuttle'];
  12. $gas=$_POST['gas'];
  13. $miles=$_POST['miles'];
  14. $cost=$_POST['cost'];
  15.  
  16. $getlastpri= "(SELECT * FROM '$table' ORDER BY `prikey` DESC)";
  17.  
  18.  
  19. $sql=mysql_query($getlastpri);
  20. $i=0;
  21. $num=mysql_result($prime,$i,$prikey);
  22. $shut=NULL;
  23. while ($shut != $shuttle){
  24. $shut=mysql_result($sql,$i,shuttle);
  25. $i++;}
  26. if($shut == $shuttle)
  27. {$pastmiles=mysql_result($sql,$i,miles);}
  28. else
  29. $pastmiles=Null;
  30.  
  31.  
  32. if($pastmiles=Null):
  33. {$milestravled=Null;}
  34. else:
  35. $milestravled=$miles-$pastmiles;
  36.  
  37. $milespergallon=($milestravled/$gas);
  38.  
  39.  
  40.  
  41. $abc= "INSERT INTO $table VALUES ('','$driver','$shuttle','$gas','$miles','$cost', '$milestravled','$milespergallon')";
  42. mysql_query($abc);
  43.  
  44. mysql_close();
  45. echo "Your latest information has been input into the server";
  46. ?>`
  47.  
  48. $getlastpri= "(SELECT * FROM '$table' ORDER BY `prikey` DESC)";
  49.  
  50. $getlastpri= "SELECT * FROM `$table` ORDER BY `prikey` DESC";
  51.  
  52. if($pastmiles=Null):
  53. {$milestravled=Null;}
  54. else:
  55.  
  56. if($pastmiles == Null){
  57. $milestravled=Null
  58. }
  59.  
  60. <?
  61. if($a):
  62. echo $a;
  63. if($b) {
  64. echo $b;
  65. }
  66. else:
  67. echo $c;
  68. endif;
  69. ?>
  70.  
  71. if($pastmiles=Null):
  72. {$milestravled=Null;}
  73. else:
  74. $milestravled=$miles-$pastmiles;
  75.  
  76. if (NULL == $pastmiles)
  77. ...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement