Jump to content

formatting sql results in set columns


nathan100

Recommended Posts

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>';

}

?>

 

 

Link to comment
https://forums.phpfreaks.com/topic/164740-formatting-sql-results-in-set-columns/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.