Forum Moderators: coopster

Message Too Old, No Replies

Span Photo's

         

neroag

2:23 pm on Sep 16, 2005 (gmt 0)

10+ Year Member



Hi Everyone, probably a simple NooB question but can i hell get it to work, im try to get the following to display the photo's 3 across..
pic1 pic2 pic3 ...
but o cant get it to anything other than..
Pic1
Pic2

Can anyone help plz

<?

require('config.php');
$name ="Holidays";
mysql_connect($dhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * FROM details WHERE maindir = '$name'";
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();
$i=0;
while ($i < $num) {
$name2=mysql_result($result,$i,"maindir");
$photoa=mysql_result($result,$i,"maincont");
$path2 ="$name/$photoa";
echo '<table cols="2" border="0" cellpadding="10" cellspacing="0" align="center" width="100%">';
print "<td><a href=\"$path" . $path2 . "\"><img src=\"$path" . $path2 . "\" width=129 height=160><td><tr>";
echo "</td></tr>
$i++;
}

Thanx Everyone

echo "</table>";
?>

pnllan

4:24 pm on Sep 16, 2005 (gmt 0)

10+ Year Member



This is something I use. Please note that I have included the associative styling:

<table>
<?php
$counter=0;
?>
<tr>
<?php
do {
echo ('<td class="tdroster">');
echo ('<div align="center">');
echo '<a href="roster_detail.php?id='.$row_diesel_records['id'].'"><img src="'.$row_diesel_records['rosterpath'].'" alt="'.$row_diesel_records['name'].'" /><br />';
echo $row_diesel_records['name'];
echo "</a>";
echo "</div>";
echo '<p class="rostertext">';
echo $row_diesel_records['short_desc'];

echo "</p>";
echo "</td>";
if ($counter==1) { //THIS IS FOR A TWO-COLUMN LAYOUT - CHANGE TO 2 for THREE-COLUMN LAYOUT
echo "</tr><tr>";
$counter=0;
} else {
$counter++;
}
}
while ($row_diesel_records = mysqli_fetch_assoc($diesel_records));

// evaluate whether the dataset has an odd or even number of rows via bitwise eval - CHANGE TO SUIT YOUR NEED
if (1 & $totalRows_diesel_records) {
echo "</tr>";
} else {
echo "<td></td></tr>";
}

?>
</table>

The BITWISE EVALUATION is used to properly close the opened TABLE (HTML table). Most sites I work with insist that their pages validated against W3C.

Let me Know how It works Out...