title: Display the record of selected user in php mysql
body: <p>I m trying to display the records of 2 tables in a single table using php and mysql.
  I have 2 tables member and payment</p>
  
  <p>member</p>
  
  <pre><code>id | name |.....
  ----------
  101 | abc |..
  </code></pre>
  
  <p>and payment table contains</p>
  
  <pre><code>id | uid | amount
  ----------
  1 | 101 | 1200
  </code></pre>
  
  <p>i want to display the record of entered no.My table displays all the rows.
  I want to display the record of only 1 number.</p>
  
  <p>here is the code..
   This is page1 where user as to enter a number and the records of dat number as to display in second page.</p>
  
  <pre><code>&lt;form method="post" action="reportdet2.php"&gt;
  &lt;label type="text" name="name" maxlength="50" size="30" class="label"&gt;Enter the Membership Number which You waant to edit&lt;/label&gt;&lt;br /&gt;
  &lt;input type="text" name='id' placeholder="enter Membership Number" class="input" size="40"/&gt;&lt;br /&gt;
  &lt;span class="field"&gt;(* Required field)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;
  &lt;input type="hidden" name='uid' placeholder="" class="input" size="40"/&gt;&lt;br /&gt;
  
  &lt;input type="submit" name="submit" value="SUBMIT" class="button"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;
  &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>page2 </p>
  
  <pre><code>    &lt;?php
      mysql_connect("localhost","root","");
      mysql_select_db("anthonys");
      if(isset($_POST['submit']))
      {
      $id= $_POST['id'];
  
      if( ! ctype_alnum($id) )
        die('invalid id');
      $uid=$_POST['uid'];
  
      $query="SELECT m.id, m.fathername, m.mothername
      FROM member m JOIN payment p ON m.id = p.uid";
  
  
  
      if(mysql_num_rows($run)&gt;0){
      echo "&lt;script&gt;window.open('reportdet2.php','_self')&lt;/script&gt;";
      }
  
      else {
  
          echo "&lt;script&gt;alert('Membership No is Invalid!')&lt;/script&gt;";
          }
      }
      ?&gt;
  
  
  &lt;th&gt;No&lt;/th&gt;
  &lt;th&gt;Name&lt;/th&gt;
  
  
  &lt;th&gt;UID&lt;/th&gt;
  
  &lt;th&gt;Amount&lt;/th&gt;
  
  &lt;/tr&gt;
  
  
  &lt;?php
  $id="";
  $id=$_REQUEST["id"];
  
  $uid=$_REQUEST["uid"];
  mysql_connect("localhost","root","");
  mysql_select_db("anthonys");
  $query="SELECT m.id, m.fathername, m.mothername
  FROM member m JOIN payment p ON m.id = p.uid";
  
  $run= mysql_query($query);
  
  
  
  
  
  
  while($row=mysql_fetch_array($run))
  {
  $id=$row[0];
  $name=$row[1];
  $uid=$row[2];
  
  $amount=$row[3];
  
  
  ?&gt;
  
  &lt;tr align='center'&gt;
  &lt;td&gt;&lt;?php echo $id; ?&gt;&lt;/td&gt;
  
  &lt;td&gt;&lt;?php echo $name; ?&gt;&lt;/td&gt;
  &lt;td&gt;&lt;?php echo $uid; ?&gt;&lt;/td&gt;
  
  &lt;td&gt;&lt;?php echo $amount; ?&gt;&lt;/td&gt;
  
  
  
  &lt;/tr&gt;
  &lt;?php } ?&gt;
  &lt;/table&gt;
  
  &lt;?php
          $result = mysql_query("SELECT sum(amount) FROM payment") or die(mysql_error());
          while ($rows = mysql_fetch_array($result)) {
      ?&gt;
      &lt;div class="pull-right"&gt;
          &lt;div class="span"&gt;
              &lt;div class="alert alert-success"&gt;&lt;i class="icon-credit-card icon-large"&gt;&lt;/i&gt;&amp;nbsp;Total:&amp;nbsp;&lt;?php echo $rows['sum(amount)']; ?&gt;&lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
      &lt;?php }
      ?&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>