Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $user="root";
- $pass="";
- $host="localhost";
- $dbnamne="near_deal_custome";
- $store_id = $_REQUEST['store_id'];
- $file_path=basename($_FILES['file']["name"]);
- $file_name=$_FILES['file']["tmp_name"];
- $result=array("success"=>$_FILES['file']["name"]);
- $localPath='gambar/'.$file_path;
- if (move_uploaded_file($file_name, $localPath)) {
- # code...
- }else{
- $result=array("success"=>false);
- return $result;
- }
- /*$store_id = 3;
- $lat = 0;
- $lng = 0;
- */
- //$store_id = 3;
- //create connection
- $conn = new mysqli($host, $user, $pass, $dbnamne);
- //check connection
- if($conn->connect_error){
- die("connection failed" .$com->connect_error);
- }
- //[nama formula menghitung 2 titik koordinat : mysql great circle distance]
- //$sql = "SELECT * FROM store";
- $sql = "UPDATE store SET photo='$localPath' WHERE Id={$store_id}";
- $resultQuery = $conn->query($sql);
- if ($resultQuery>0) {
- echo json_encode(array(
- 'success' => true
- ));
- }else{
- echo json_encode(array(
- 'success' => false
- ));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement