html - PHP and mysql Table -
so developing basic website reports locations of items stored in database. trying create table of results tables stored within phpmyadmin.
what want make each table row link page item expanded more detail (individual page result). e.g. person clicks on row relating shop directed page shop. how do using php. see code below
while($row = mysqli_fetch_assoc($results)){ $ratingstars = ""; $ratingno = $row[rating]; for($i=0; $i<$ratingno; $i++){ $ratingstars .= "★ "; } echo "<form action='' method='post'>"; echo "<tr id=". $row['id'] .">"; echo "<td class='lrg-tbl-row'>" . $row["hotspot-name"] . "</td>"; echo "<td class='lrgz-tbl-row'>" . $row["address"] . "</td>"; echo "<td class='lrg-tbl-row'>" . $row["suburb"] . "</td>"; echo "<td class='sml-tbl-row'>" . $ratingstars . "</td>"; echo "<td>" . "<input type='submit' name = 'submit' value='text'/>" . "</td>"; echo "</tr>"; echo "</form>"; }
no need form submit. create link go other page. if want can encode id value. also
while($row = mysqli_fetch_assoc($results)){ $ratingstars = ""; $ratingno = $row[rating]; for($i=0; $i<$ratingno; $i++){ $ratingstars .= "★ "; } echo "<tr id=". $row['id'] .">"; echo "<td class='lrg-tbl-row'>" . $row["hotspot-name"] . "</td>"; echo "<td class='lrgz-tbl-row'>" . $row["address"] . "</td>"; echo "<td class='lrg-tbl-row'>" . $row["suburb"] . "</td>"; echo "<td class='sml-tbl-row'>" . $ratingstars . "</td>"; echo "<td>" . "<a href='<your domain>/?id=" .$row['id'] . "'>view details</a></td>"; echo "</tr>"; }
Comments
Post a Comment