Hi,
I am trying to link to page that shows some of the data in a table. It's not working right because if the table has for example, 3 rows of data, three links show up. I just want there to be one link and when you click the link, it will show all three rows of data. Also, when I click the link, only one row of data shows up. Can someone help me?
Here is the code for the page with the link:
}
$query = "SELECT clientid,clientname,date,utilityco,account,reason,notes,amount from claims";
$result = mysql_query($query) or die('Sorry, could not get data at this time ');
if (mysql_num_rows($result) == 0)
{
echo "<h3>Sorry, there are no claims posted at this time, please try back later.</h3>";
} else
{
while($row=mysql_fetch_array($result, MYSQL_ASSOC))
{
$clientid = $row['clientid'];
$clientname = $row['clientname'];
$date = $row['date'];
$utilityco = $row['utilityco'];
$account = $row['account'];
$reason = $row['reason'];
$notes = $row['notes'];
$amount = $row['amount'];
echo "<a href=\"index.php?content=showclaims&id=$clientid\">Refund Claims</a>\n";
}
}
?>
Here is the code for the target page:
<?php
$con = mysql_connect("localhost", "test", "test") or die('Sorry, could not connect to server');
mysql_select_db("tristem", $con) or die('Sorry, could not connect to database');
$clientid = $_GET['id'];
$query = "SELECT clientid,clientname,date,utilityco,account,reason,notes,amount from claims where clientid = $clientid";
$result = mysql_query($query) or die('Sorry, could not find data requested');
$row = mysql_fetch_array($result, MYSQL_ASSOC) or die('No records retrieved');
$clientid = $row['clientname'];
$clientname = $row['clientname'];
$date = $row['date'];
$utilityco = $row['utilityco'];
$account = $row['account'];
$reason = $row['reason'];
$notes = $row['notes'];
$amount = $row['amount'];
echo "<h1>$clientname</h1><br><br>\n";
echo "<h3>Date:</h3> $date <br><br>\n";
echo "<h3>Utility Company:</h3> $utilityco <br><br>\n";
echo "<h3>Accounts:</h3> $account <br><br>\n";
echo "<h3>Reason:</h3> $reason <br><br>\n";
echo "<h3>Notes:</h3> $notes <br><br>\n";
echo "<h3>Amount:</h3> $amount <br><br>\n";
echo "<br><br>\n";
?>