prepare("INSERT INTO location (username,age,transport,description,defect,topic,lng,lat) VALUES (:username,:age,:transport,:description,:defect,:topic,:lng,:lat)"); $stmt->bindValue(':username', $strUsername); $stmt->bindValue(':age', $strAge); $stmt->bindValue(':transport', $strTransport); $stmt->bindValue(':description', $strDescription); $stmt->bindValue(':topic', $numTopic); $stmt->bindValue(':lng', $numLng); $stmt->bindValue(':lat', $numLat); $stmt->bindValue(':defect', $numDefect); $stmt->execute(); // fetch last_id - sqlite $strSQL="SELECT id FROM location ORDER BY id DESC limit 1"; $result = $db->query($strSQL); if ($row = $result->fetch(PDO::FETCH_ASSOC)) { $id = $row['id']; } // Write address data to table address $data=getAddress($numLat,$numLng); if ($data) { writeAddress($db,$id,$data); } // Store File Upload if ($boolUploadOk) { $strSQL="INSERT INTO files (loc_id,filename,filesize,filetype) VALUES (:loc_id,:filename,:filesize,:filetype)"; $stmt = $db->prepare($strSQL); $stmt->bindValue(':loc_id',$id); $stmt->bindValue(':filename',$filename); $stmt->bindValue(':filesize',$filesize); $stmt->bindValue(':filetype',$filetype); $stmt->execute(); } // Retrun Markertext of entry $strSQL="SELECT loc.*,f.filename FROM location loc LEFT JOIN files f ON loc.id=f.loc_id ORDER BY loc.id DESC limit 1"; $result = $db->query($strSQL); if ($row = $result->fetch(PDO::FETCH_ASSOC)) { $markerText=generate_tooltip_description($row); $markerText=stripcslashes($markerText); } echo ($markerText);