internetguy
Technical User
I have a photo gallery with pictures from me and 2 friends. I have it select which photographer based on Get variables, and all the picture information is stored in a mysql database. I got the photos to sort each picture by row, but I want to sort two pictures per row.
This is what is happening...
col1 col2
| pic1 | pic1 |
| pic2 | pic2 |
| pic3 | pic3 |
What I want is...
col1 col2
| pic1 | pic2 |
| pic3 | pic4 |
here is my code
if (!isset($_GET['artist'])){
//Content introducing brent, joe and I
echo "<a href='photos.php?artist=brent'>Brent Darting</a><br>";
echo "<a href='photos.php?artist=james'>James Devan</a><br>";
echo "<a href='photos.php?artist=joe'>Joseph Hinton</a>";
} else {
$artist = $_GET['artist'];
mysql_connect('localhost','root');
mysql_select_db('justjd');
$query = "SELECT * FROM photos WHERE artist='".$artist."' ORDER by `name` LIMIT 0,10";
$result = mysql_query($query);
$num = mysql_num_rows($result);
for($num; $num > 0; $num--){
$row = mysql_fetch_array($result);
echo "<table width='420' border='0' cellspacing='0'>";
echo "<tr>\n<td align='center' width='210'>\n<a href='pics/photos/".$artist."/".$row['img']."'>\n<img src='pics/photos/".$artist."/thumbs/".$row['img']."' border='0'></a>\n<br>\n".$row['name']." - ".sizes($artist,$row['img'])."</td>";
echo "<td align='center'>\n<a href='pics/photos/".$artist."/".$row['img']."'>\n<img src='pics/photos/".$artist."/thumbs/".$row['img']."' border='0'></a>\n<br>\n".$row['name']." - ".sizes($artist,$row['img'])."</td>\n</tr>";
echo "</table>";
}
}
This is what is happening...
col1 col2
| pic1 | pic1 |
| pic2 | pic2 |
| pic3 | pic3 |
What I want is...
col1 col2
| pic1 | pic2 |
| pic3 | pic4 |
here is my code
if (!isset($_GET['artist'])){
//Content introducing brent, joe and I
echo "<a href='photos.php?artist=brent'>Brent Darting</a><br>";
echo "<a href='photos.php?artist=james'>James Devan</a><br>";
echo "<a href='photos.php?artist=joe'>Joseph Hinton</a>";
} else {
$artist = $_GET['artist'];
mysql_connect('localhost','root');
mysql_select_db('justjd');
$query = "SELECT * FROM photos WHERE artist='".$artist."' ORDER by `name` LIMIT 0,10";
$result = mysql_query($query);
$num = mysql_num_rows($result);
for($num; $num > 0; $num--){
$row = mysql_fetch_array($result);
echo "<table width='420' border='0' cellspacing='0'>";
echo "<tr>\n<td align='center' width='210'>\n<a href='pics/photos/".$artist."/".$row['img']."'>\n<img src='pics/photos/".$artist."/thumbs/".$row['img']."' border='0'></a>\n<br>\n".$row['name']." - ".sizes($artist,$row['img'])."</td>";
echo "<td align='center'>\n<a href='pics/photos/".$artist."/".$row['img']."'>\n<img src='pics/photos/".$artist."/thumbs/".$row['img']."' border='0'></a>\n<br>\n".$row['name']." - ".sizes($artist,$row['img'])."</td>\n</tr>";
echo "</table>";
}
}