title: PHP + HTML table: Fire appropriate MySql query from each cell of the table
body: <p><em>The title is not most suitable, but this is the best I could think of. Feel free to suggest EDIT.</em></p>
  
  <p><strong>Summary:</strong></p>
  
  <p>I have come from Android development where I have used <a href="http://enoent.fr/images/articles/recyclerview-basics/recyclerview-grid-3-vertical.png" rel="nofollow"><code>RecyclerView</code></a> to show a grid of various items from the database. There I could use the <code>onClickListener()</code>and <code>Position</code>  to get which <code>RecyclerView</code> item <em>(first,second,third..)</em> is clicked by user and can proceed with actions. </p>
  
  <p><strong>Set up:</strong></p>
  
  <p>I am new to web development and by far I have managed to create an <code>HTML</code> table and I am firing appropriate query to get items from the database. I am then showing these data from database in each table cell. The data consists of image link (from a folder in same directory) and other text data about that image. My table looks something like this. <a href="http://postimg.org/image/tts7z4psv/" rel="nofollow">Click here</a></p>
  
  <p><strong>Problem:</strong></p>
  
  <p>I want to add an options like <code>Accept</code> in each cell of the table such that when user clicks on that, a query fires to set the Boolean <code>isAccepted</code> <strong>for that item</strong> in DB as true. I can manage the query part but I am facing problem how to set this up in my php script. </p>
  
  <p><strong>What do I ecpect?</strong></p>
  
  <p>That's absolutely OK if I dont get the ready made code. I want to be guided as what technology to be used and if possible a link to the guiding tutorial. I hope it can be done usng PHP and HTML only. </p>
  
  <p>My php script:</p>
  
  <pre><code>&lt;table id="customers"&gt;
  &lt;?php
  
  $MAX_COLS = 5;
  
  $query = "select * FROM `complaints`";
  $result = mysqli_query($conn,$query);
  
  $i = 0;
  while($row = mysqli_fetch_row($result)){
      if($i % $MAX_COLS == 0){
          echo "&lt;tr&gt;";
      }
      echo "&lt;td&gt;";
      echo "&lt;img src='SCB2/Images/temp2.jpg' alt='Sample image' style='width:200px;height:200px;' &gt;";
      echo "&lt;br&gt;"."Image ID: ".$row[0];
      echo "&lt;br&gt;"."Latitude: ".$row[2];
      echo "&lt;br&gt;"."Longitude: ".$row[3];
      echo "&lt;br&gt;"."Zip: ".$row[4];
      echo "&lt;br&gt;"."Done by: ".$row[8];
      echo "&lt;td&gt;";
      $i++;
      if($i % $MAX_COLS == 0){
          echo "&lt;/tr&gt;";
      }
  }
  ?&gt;
  &lt;/table&gt;
  </code></pre>