Posted by Denis Gerina on 06/08/07 21:34
c19h28o2 wrote:
> Hi,
>
> I have created a table on the fly from mysql
>
> while($row = mysql_fetch_array($query)) {
>
> echo "<tr>";
> echo "<td class='body'><a href='#'>".$row['au_id']."</a></td>";
> echo "<td class='body'>".$row['au_fname']."</td>";
> echo "<td class='body'>".$row['au_lname']."</td>";
> echo "</tr>";
> }
>
> is there anyway of getting the current clicked au_id? i would like the
> user to click the id to display more information but I'm unsure how to
> get the currently clicked id...
>
> Thanks
>
One way:
while($row = mysql_fetch_array($query)) {
$auid = $row['au_id'];
echo "<tr>";
echo "<td class='body'><a
href='moreinfo.php?id=$auid'>".$row['au_id']."</a></td>";
//or something like
//echo "<td class='body'><a
href='moreinfo.php?id={$row['au_id']}'>".$row['au_id']."</a></td>";
//which I find really ugly :)
echo "<td class='body'>".$row['au_fname']."</td>";
echo "<td class='body'>".$row['au_lname']."</td>";
echo "</tr>";
}
On moreinfo.php, you'd have
<?php
$auid = $_GET["id"];
//do something with that particular author...
?>
Navigation:
[Reply to this message]
|