Author Topic: formatting sql results in set columns  (Read 155 times)

0 Members and 1 Guest are viewing this topic.

Offline nathan100Topic starter

  • Irregular
  • Posts: 13
    • View Profile
formatting sql results in set columns
« on: July 04, 2009, 04:30:28 AM »
Hi,
I am trying to create a very basic friends list. The code is below. However, I am now trying to put the results in to a 5x5 grid.... BUT also if there are more results than 25, then a link saying "view all" .. and then all are shown without reload.

Here is what I have so far...

<?php
// Make a MySQL Connection
mysql_connect("localhost", "username", "password") or die(mysql_error());
mysql_select_db("database") or die(mysql_error());

// Get all the data from the "example" table
$result = mysql_query("select statement here")

or die(mysql_error()); 

echo '<div id="following_list">';
while($row = mysql_fetch_array( $result )) {
$alt = $row['name'];
echo '<span class="vcard">';
echo "<img SRC = ".$row['imgpath']." width=\"25\"  height=\"25\" alt=".$alt." title=".$alt."></a>";
echo '</span>';
}
?>


Offline nathan100Topic starter

  • Irregular
  • Posts: 13
    • View Profile
Re: formatting sql results in set columns
« Reply #1 on: July 04, 2009, 04:40:49 AM »
If this is too much of an ask - even the table grid would really help... totally stuck on it.