richiec Posted July 13, 2007 Share Posted July 13, 2007 http://fearedwarlords.dks-gfx.com/timeframe/ ok, each image has its own row in the sql table which has the time, date and name also (for the mouse over) But.. I need them to be next to eachother insted of on a different line on the site.. this is my current code.. $result=mysql_query($query) or die(hmm); $num = mysql_num_rows($result); $i=0; while ($i < $num) { $name = mysql_result($result,$i,"name"); $date = mysql_result($result,$i,"date"); $time =mysql_result($result,$i,"time"); $image =mysql_result($result,$i,"image"); $i++; echo "<div align=\"center\"><a href=\"#\" target=\"_parent\" title=\"$name is due on the $date at $time\"> <img src=\"$image\" /><span class=\"style1\"></span></div> "; } any ideas how i can get the images to display next to eachother insted of on a new line for each image? Link to comment https://forums.phpfreaks.com/topic/59878-solved-not-sure-how-to-explain-in-a-subject-but-i-need-help/ Share on other sites More sharing options...
pocobueno1388 Posted July 13, 2007 Share Posted July 13, 2007 Try this: <?php $result=mysql_query($query) or die(hmm); $num = mysql_num_rows($result); $i=0; echo "<div align=\"center\">"; while ($i < $num) { $name = mysql_result($result,$i,"name"); $date = mysql_result($result,$i,"date"); $time =mysql_result($result,$i,"time"); $image =mysql_result($result,$i,"image"); $i++; echo " <a href=\"#\" target=\"_parent\" title=\"$name is due on the $date at $time\"> <img src=\"$image\" />"; } echo '</div>'; ?> That will spit them all out on the same line. Did you want it to start a new line after X amount of images displayed? Link to comment https://forums.phpfreaks.com/topic/59878-solved-not-sure-how-to-explain-in-a-subject-but-i-need-help/#findComment-297751 Share on other sites More sharing options...
richiec Posted July 13, 2007 Author Share Posted July 13, 2007 that works great thank you, and yes that would be helpful because i will be adding more images to that over time so it would be good to know how to do that. thanks again Link to comment https://forums.phpfreaks.com/topic/59878-solved-not-sure-how-to-explain-in-a-subject-but-i-need-help/#findComment-297754 Share on other sites More sharing options...
pocobueno1388 Posted July 13, 2007 Share Posted July 13, 2007 <?php $result=mysql_query($query) or die(hmm); $num = mysql_num_rows($result); $i=0; echo "<div align=\"center\">"; $count = 1; while ($i < $num) { $name = mysql_result($result,$i,"name"); $date = mysql_result($result,$i,"date"); $time =mysql_result($result,$i,"time"); $image =mysql_result($result,$i,"image"); if ($count == 5){ //This is how columns you would like echo '<br>'; $count = 0; } echo " <a href=\"#\" target=\"_parent\" title=\"$name is due on the $date at $time\"> <img src=\"$image\" />"; $count++; $i++; } echo '</div>'; ?> This will make a new line after every 5 images, you can change the number 5 to whatever you need. Link to comment https://forums.phpfreaks.com/topic/59878-solved-not-sure-how-to-explain-in-a-subject-but-i-need-help/#findComment-297756 Share on other sites More sharing options...
richiec Posted July 13, 2007 Author Share Posted July 13, 2007 thank you very much for the help Link to comment https://forums.phpfreaks.com/topic/59878-solved-not-sure-how-to-explain-in-a-subject-but-i-need-help/#findComment-297758 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.