Hello,
I am almost positive that this is a very simple question (I say, as I wait for my "SQL for Dummies" and "PHP for the absolute beginner" books).
I have a table of parts. I then have a query results page.
<?php
$conn=pg_pconnect("dbname=foo user=foofoo password=foobar");
$sql="SELECT * FROM parts WHERE part_number ~~* '%$_POST[partnum]%'";
$result=pg_exec($conn, $sql);
if($result) {
echo "\n";
} else {
echo "Error, you need to enter a part number to search for.\n";
}
?>
<TABLE border="1" frame="border" summary="This table gives the results from a parts lookup query." ALIGN="left">
<?php
{
echo '<tr><th>Part Number</th><th>Description</th><th>Details</th>';
while($row = pg_fetch_array($result))
echo '<tr><td>'.$row['part_number'].'</td><td>'.$row['part_desc'].'</td><td><a href="partdetail.php?part_number">View</a>
</td>
</tr>';
echo '</table>';
?
}
?>
Right now if I type in a partial part number for the query it returns a list of like parts, which is what I want it to do.
Results:
Part Number -- Description -- Details
35A-50000 -- Nose Wheel Assembly -- View
35-24000 -- Water Rudder Assembly -- View
I want to be able to pull up the "partdetail.php" by clicking on the "view" link and have it bring up the details from the first column part number.
Currently, when I click on the "view" link, I always have the details for ALL the part numbers in the table returned. I think it is because I am referencing "part_number" instead of the first column in the specific row. This is my problem, I don't know how to point to the first column in a specific row.
Does anyone have an example or point to a tute or link that can help me, if it is even (dare I say) possible?
Thanks,
G