title: Delete PHP (mysqli) row - with HTML/Javascript button
body: <p>Using google maps, I have events saving to a database using mysqli. These events are then displayed as markers on the map and when clicked the relevant data is displayed in an info box (Name, date, etc). I want the option to delete an event event by deleting a row from the DB when the Remove (remove-event) button is clicked. The button is contained in the data displayed with the javascript: </p>
  
  <pre><code>var eventContent = $('&lt;div class="event-info"&gt;' + '&lt;h4 class="event-name"&gt;' +     point.name + '&lt;/h4&gt;&lt;hr&gt;' +
          '&lt;span&gt;&lt;h5&gt;Date: &lt;/h5&gt;' +
          '&lt;p class="event-date"&gt;' + point.edate + '&lt;/p&gt;&lt;/span&gt;' +
          '&lt;p class="event-description"&gt;'+point.description+'&lt;/p&gt;' +
          '&lt;/span&gt;&lt;button id="remove-event" name="remove-event" class="remove-event btn btn-danger btn-sm" onclick="tidy_maps.delete()" title="Remove Event"&gt;Remove Event&lt;/button&gt;'+
          '&lt;/div&gt;');
  
      // Display Event details on marker click
      google.maps.event.addListener(event_markers[i], "click", function () {
          infowindow.setContent(eventContent[0]);
          infowindow.open(map, event_markers[i]);
  </code></pre>
  
  <p>The script that sends it to the php (removedata.php):</p>
  
  <pre><code>tidy_maps.delete = function() {
      $.ajax({
          type:'POST',
          url:'removedata.php',
          success:function(data) {
              if(data) {
                  alert("Are you sure?");
              }
              else {
                  alert("ERROR!!!!");
              }
          }
      });
  }
  </code></pre>
  
  <p>The removedata.php is:</p>
  
  <pre><code>$con = mysqli_connect("localhost", "root", "password", "gmaps1");
  if (!$con) {
  die("Can not connect: " .mysql_error());
  }
  
  $sql = "DELETE FROM events WHERE id = 'id' ";
  
  $query = mysqli_query($con, $sql);
  
  if(mysqli_affected_rows($con)) {
      echo "Record deleted successfully";
  }
  
  mysqli_close($con);
  </code></pre>
  
  <p>As it is, it does not delete the row in the DB, but when i change the line:</p>
  
  <pre><code>$sql = "DELETE FROM events WHERE id = 'id' ";
  </code></pre>
  
  <p>to a specific ID No. Example:</p>
  
  <pre><code>$sql = "DELETE FROM events WHERE id = '5' ";
  </code></pre>
  
  <p>And i run the removedata.php in the browser, it deletes the row with ID=5 from the DB. There seems to be no errors when the console when clicking the remove button so it must be sending to PHP script ok.</p>
  
  <p>I would like when the Remove button is clicked that it asks are you sure and then it deletes that specific Row form the DB.</p>