<?php // Create connection $con=mysqli_connect("localhost","root","root"); mysql_select_db("test") or die( "Unable to select database"); if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } //***************************** table 1 detail *********** $query = "SELECT * FROM fraud WHERE a_number=" . $_GET["aNun_id"]; echo "<title>" . $_GET["aNun_id"] . "</title>"; echo "<table width='50%' border='5'> <tr> <th>Date & Time</th> <th>A Number</th> <th>B Number</th> <th>Status</th> </tr>"; $result=mysql_query($query) or die (mysql_error()); while($row=mysql_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['date'] . "</td>"; echo "<td>" . $row['a_number'] . "</td>"; echo "<td><a href='?bNun_id=".$row['b_number']."'>" . $row['b_number'] . "</a></td>"; echo "<td>" . $row['status'] . "</td>"; echo "</tr>"; } echo "</table>"; //***************************** table 2 detail *********** //Here i'm trying to use bNum_id in below query $query = "SELECT * FROM fraud WHERE b_number=" . $_GET["bNun_id"]; echo "<table width='50%' border='5'> <tr> <th>Date & Time</th> <th>A Number</th> <th>B Number</th> <th>Status</th> </tr>"; $result=mysql_query($query) or die (mysql_error()); while($row=mysql_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['date'] . "</td>"; echo "<td>" . $row['a_number'] . "</td>"; echo "<td>" . $row['b_number'] . "</td>"; echo "<td>" . $row['status'] . "</td>"; echo "</tr>"; } echo "</table>"; //connection close mysqli_close($con); ?>
Here in table one , I used aNun_id to get the data from another PHP file with "GET" command. In the table two, I want bNun_id to show its related data in that table. How do i call bNun _id data to the second table from table one. Pls help me..