hey folks,
I'm fairly new to PHP so am not sure how to do this.
I have records in a database that link to images (profile pictures) that i want to display 5 along and 4 down. How would I do this?
Thanks alot!
Jonesy
hey folks,
I'm fairly new to PHP so am not sure how to do this.
I have records in a database that link to images (profile pictures) that i want to display 5 along and 4 down. How would I do this?
Thanks alot!
Jonesy
First I would find a decent MySQL Tutorial. Then I would practice running some basic SELECT
queries.
After you've done that it's as simple as
$sql = "SELECT `picture_link` FROM `users` WHERE 1";
$query = $this->db->query($sql);
foreach($query->result() as $row)
{
echo $row->picture_link;
}
Note, this code is generalized
General table code
echo "<table><tr>";
$count = 1;
foreach($query->result() as $row)
{
if($count % 5 == 0)
{
echo "</tr><tr>";
}
echo "<td>" . $row->picture_link . "</td>";
$count++;
}