html - PHP retrieval with MYSQL -
i sorry if find difficult understand. looking way stop results mysql populating outside of div. example;
echo " <table> <tr> <td> <a href='index.php?option=user&place=quest&id=$row[id]&time=$row[time]'> <img src='media/quest/$row[id].jpg' height=50 width=50 onmouseover='tooltip' title='$row[description]'> </a> </td> <td>" . $row['name'] . "</td> <td>" . gmdate("i:s", $row['time']) . "</td> <td>"; the above code works example if have 10 results go across page. , ignore rules of div.
basically looking when 5 results populate results move down row. if add @ end of current code problem goes vertically oppose horizontal.
![as can see in image background map [so speak] background of div , there results outside of div. looking way stop populating outside of div , instead create new row. hope makes more sense1
so if want create table 5 results per row assuming $result result returned query, go this:
echo "<table><tr>"; $count = 0; while($row = mysqli_fetch_assoc($result)){ $count++; if ($count % 5) echo "</tr><tr>"; echo " <td> <a href='index.php?option=user&place=quest&id=$row[id]&time=$row[time]'> <img src='media/quest/$row[id].jpg' height=50 width=50 onmouseover='tooltip' title='$row[description]'> </a> </td> <td>" . $row['name'] . "</td> <td>" . gmdate("i:s", $row['time']) . "</td>"; } echo "</tr></table>"; now implemented cleaner, simple sample should serve.
Comments
Post a Comment