Hi there,
I'm new to php but i've done a couple of things already such as inserting from a txt file etc...so i'm happy about that so far.
Now that I've got information in the db I want to have it echoed.
Question is as following;
I want to show a list of categorised galleries on a page, in a <table>
Something 4 rows and 4 columns.
I wanted to have a different category of galleries in each colum. The question is how to do it.
Everything works in one column but I don't have a clue what I need to do.
Could someone help me 🙂
this is what I have right now (without the html stuff)
If I would add a <table>...what php code and query would i need to add for each column?
If you have the time I can also be reached on icq: 256664696
Thanx
<?php
$Sitename = str_replace("-","",$_GET['Sitename']);
$cnx = mysql_connect("localhost","XXXXXXXXXX","XXXXXXXXXXXX") or die ("Could not connect");
mysql_select_db('dbname', $cnx) or die (mysql_error());
$sql = "SELECT * FROM XXXXXXXXX ORDER by RAND()";
?>
<?
$result = mysql_query($sql) or die (mysql_error()); // query the DB
$y = (int)(mysql_num_rows($result) / 3);
//echo $y;
for ($x = 0;$x < mysql_num_rows($result);$x++)
{
$row = mysql_fetch_assoc($result);
$closed = str_replace(" ","",$row[Sitename_closed]);
echo "<a href=/$row[id]/".$closed."/ title=".$row[Sitename_open]."><p>".$row[Message]."</a></p>\n";
print ($x % $y) ? "" : "\n";
}
?>