Hello,
i am trying to create a homepage with random images and data displayed... e.g the items picture and price....
i have managed now to do this but i get duplicates how can i stop this... see here
http://tom. btronics. co. uk (remove spaces).
the code so far...
<?php
mysql_connect("Connection settings");
mysql_select_db("connectionsettings")or die("cannot select DB");
$sql="SELECT * FROM items ORDER BY rand() LIMIT 1";
$result=mysql_query($sql);
while($rows=mysql_fetch_array($result)){
?>
<table border="0" align="center" style="max-height:100; max-width:100">
<tr>
<td align="center" valign="middle"><a href="<? echo $rows['image']; ?>" target="_blank"><img src="<? echo $rows['image']; ?>" alt="<?
echo "#";
echo $rows['code'];
echo " - ";
echo $rows['name'];
?>" border="0" class="mediumimage"/></a></td>
</tr>
<tr>
<td align="left" valign="middle"><div align="center" class="style18"><strong>#<? echo $rows['code']; ?></strong><em> - <? echo $rows['name']; ?></em></div></td>
</tr>
<tr>
<td align="left" valign="middle"><div align="center"><strong>£<? echo $rows['price']; ?></strong></div></td>
</tr>
</table><?
}
mysql_close(); //close database
?>
at the moment i have just copied this code into 10 cells...
thanks in advance
🙂