title: updating a particular field with id in php my sql data table
body: <p><img src="https://i.stack.imgur.com/EgcJh.png" alt="Scrrenshot Of Page"></p>
  
  <p>Above is the screen shot of my page. My problem is i'm getting the data from my sql table and creating a php data table like this:</p>
  
  <pre><code>&lt;?php
  $s="select * from events join event_time on (events.event_id=event_time.event_id)
  
  where events.isapproved='N' ";
  $res=mysql_query($s);
  echo "&lt;table border='1' cellspacing='2' &gt;
  &lt;tr&gt;
  &lt;th&gt;title&lt;/th&gt;
  &lt;th&gt;email&lt;/th&gt;
  &lt;th&gt;address&lt;/th&gt;
  &lt;th&gt;link&lt;/th&gt;
  &lt;th&gt;start_date&lt;/th&gt;
  &lt;th&gt;start_time&lt;/th&gt;
  &lt;th&gt;end_date&lt;/th&gt;
  &lt;th&gt;isapproved&lt;/th&gt; 
  &lt;/tr&gt;";
  while($info = mysql_fetch_array( $res )) 
  {
  echo "&lt;tr&gt;";
  echo " &lt;td&gt;".$info['title'] . "&lt;/td&gt; ";
  echo " &lt;td&gt;".$info['email'] . "&lt;/td&gt; ";
  echo " &lt;td&gt;".$info['address'] . "&lt;/td&gt; ";
  echo " &lt;td&gt;".$info['link'] . "&lt;/td&gt; ";
  echo " &lt;td&gt;".$info['start_date'] . "&lt;/td&gt; ";
  echo " &lt;td&gt;".$info['start_time'] . "&lt;/td&gt; ";
  echo " &lt;td&gt;".$info['end_date'] . "&lt;/td&gt; ";
  echo "&lt;td&gt;&lt;a href=yes.php?".$info['event_id'] ."&gt;".$info['isapproved'] ."&lt;/a&gt;&lt;/td&gt;";
  echo "&lt;td&gt;&lt;a href=del.php?".$info['event_id']."&gt;".'Delete'."&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;";
  
  }
  echo "&lt;/table&gt;";
  
  ?&gt;
  </code></pre>
  
  <p>The hyper link what i am trying to acces is
  yes.php</p>
  
  <pre><code>&lt;?php
  include("config/config.php");
  
  $sq="select * from events";
  $res=mysql_query($sq);
  while($row=mysql_fetch_assoc($res))
  {
  if($row['isapproved']=='N')
  {
  $id=$row['event_id'];
  
  }
  }
  $sql="UPDATE events SET isapproved= 'Y'
  WHERE event_id='$id'";
  
  $result = mysql_query($sql);
  
  
  header("Location:admin.php");
  ?&gt;
  </code></pre>
  
  <p>See, The function is when i click that hyper link "N" my table has to be updated(as you can see in the query) with value "Y".</p>
  
  <p>The real problem is i am getting the id when i click on "N" but when the query gt updated the row at the bottom of the table is updating as "Y". What is the problem? Can anyone look into it.. I'm dying looking out of it...</p>