What i want to do:
Get urls from the database and echo them out into a multiple columned table i.e. 4 pictures per row (recently uploaded table)
MY problem is:
I have, in my MySQL database, the urls to the pictures that have been uploaded. I'm not really sure how i would get the urls to go into multiple rows... i can do it as a single row by writing this
[code=php]
$db = "mahcuz";
$ser = "localhost" ;
$pass = "";
$usr = "root";
mysql_connect($ ser, $usr, $pass) or die ('Error connecting to mysql');
echo "Connected< br />";
mysql_select_db ($db) or die('error connection');
echo "db connected<br /><br />";
$query = "SELECT * FROM `ma_pics` WHERE `private` = 'no' ORDER BY `Util_Uploaded` DESC LIMIT 10";
$res = mysql_query($qu ery);
echo "<table>";
while($row = mysql_fetch_arr ay($res)){
echo "<tr>";
echo "<td>".$row['url']."</td>";
echo "</tr>";
}
echo "</table>";
[/code]
But of course, like i said, tha will only print 1 url per row, where as, i want 4!
Any ideas?
I know i could put another while loop within the first one but guidance is needed.
Thanks :)
Get urls from the database and echo them out into a multiple columned table i.e. 4 pictures per row (recently uploaded table)
MY problem is:
I have, in my MySQL database, the urls to the pictures that have been uploaded. I'm not really sure how i would get the urls to go into multiple rows... i can do it as a single row by writing this
[code=php]
$db = "mahcuz";
$ser = "localhost" ;
$pass = "";
$usr = "root";
mysql_connect($ ser, $usr, $pass) or die ('Error connecting to mysql');
echo "Connected< br />";
mysql_select_db ($db) or die('error connection');
echo "db connected<br /><br />";
$query = "SELECT * FROM `ma_pics` WHERE `private` = 'no' ORDER BY `Util_Uploaded` DESC LIMIT 10";
$res = mysql_query($qu ery);
echo "<table>";
while($row = mysql_fetch_arr ay($res)){
echo "<tr>";
echo "<td>".$row['url']."</td>";
echo "</tr>";
}
echo "</table>";
[/code]
But of course, like i said, tha will only print 1 url per row, where as, i want 4!
Any ideas?
I know i could put another while loop within the first one but guidance is needed.
Thanks :)
Comment