Advertisement
Guest User

Untitled

a guest
Feb 14th, 2019
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.01 KB | None | 0 0
  1. <?php
  2. $user="root";
  3. $pass="";
  4. $host="localhost";
  5. $dbnamne="near_deal_custome";
  6.  
  7. $store_id = $_REQUEST['store_id'];
  8. $file_path=basename($_FILES['file']["name"]);
  9. $file_name=$_FILES['file']["tmp_name"];
  10. $result=array("success"=>$_FILES['file']["name"]);
  11. $localPath='gambar/'.$file_path;
  12. if (move_uploaded_file($file_name, $localPath)) {
  13.     # code...
  14. }else{
  15.     $result=array("success"=>false);
  16.     return $result;
  17. }
  18.  
  19.  
  20.  
  21.  
  22. /*$store_id = 3;
  23. $lat = 0;
  24. $lng = 0;
  25. */
  26. //$store_id = 3;
  27.  
  28. //create connection
  29. $conn = new mysqli($host, $user, $pass, $dbnamne);
  30.  
  31. //check connection
  32. if($conn->connect_error){
  33.     die("connection failed" .$com->connect_error);
  34. }
  35.  
  36. //[nama formula menghitung 2 titik koordinat : mysql great circle distance]
  37.  
  38. //$sql = "SELECT * FROM store";
  39. $sql = "UPDATE store SET photo='$localPath' WHERE Id={$store_id}";
  40.  
  41. $resultQuery = $conn->query($sql);
  42.  
  43. if ($resultQuery>0) {
  44.     echo json_encode(array(
  45.         'success' => true
  46.     ));    
  47. }else{
  48.     echo json_encode(array(
  49.         'success' => false
  50.     ));
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement