Trium918 Posted May 30, 2007 Share Posted May 30, 2007 The \n character is used to create a new line, correct? Then why doesn't the code below creates a new line of images after 5 are displayed? For instance, three rows with five images on each. <?php $sql = "SELECT * FROM members_images LIMIT 5"; if ($result = mysql_query($sql)) { if (mysql_num_rows($result)) { while ($row = mysql_fetch_assoc($result)) { echo "<td> <table border=0> <tr> <td> <img src=\"./".$row['images_name']."\" width=\"100\" height=\"100\"> </td> </tr> </table> </td>\n // here is the new line character! "; //End echo } } else { echo "No results found"; } } else { echo "Query failed<br />$sql<br />" . mysql_error(); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/53603-solved-help/ Share on other sites More sharing options...
per1os Posted May 30, 2007 Share Posted May 30, 2007 lol A new line is something like this here is a new line here is also a new line. In order to get it formatted in html a newline needs to be converted to < br > but it seems like you want a new "row" not a new line. Look into the table rows. If not explain what you are trying to do clearer. Quote Link to comment https://forums.phpfreaks.com/topic/53603-solved-help/#findComment-264965 Share on other sites More sharing options...
chigley Posted May 30, 2007 Share Posted May 30, 2007 <?php $sql = "SELECT * FROM members_images LIMIT 5"; if ($result = mysql_query($sql)) { if (mysql_num_rows($result)) { echo "<table border=\"0\">"; while ($row = mysql_fetch_assoc($result)) { echo "<tr> <td> <img src=\"./".$row['images_name']."\" width=\"100\" height=\"100\"> </td> </tr>"; //End echo } echo "</table>"; } else { echo "No results found"; } } else { echo "Query failed<br />$sql<br />" . mysql_error(); } ?> That will output each one on its own "line" Quote Link to comment https://forums.phpfreaks.com/topic/53603-solved-help/#findComment-264968 Share on other sites More sharing options...
Trium918 Posted May 30, 2007 Author Share Posted May 30, 2007 lol A new line is something like this here is a new line here is also a new line. In order to get it formatted in html a newline needs to be converted to < br > but it seems like you want a new "row" not a new line. Look into the table rows. If not explain what you are trying to do clearer. lol, I donnot know what I was thinking. I am just trying to select * the images belonging to that user and diplay all of the images. Five to each row. Quote Link to comment https://forums.phpfreaks.com/topic/53603-solved-help/#findComment-264981 Share on other sites More sharing options...
trq Posted May 30, 2007 Share Posted May 30, 2007 I am just trying to select * the images belonging to that user and diplay all of the images. Five to each row. There is a googd example of this in the FAQ/Code snippet repo forum. Quote Link to comment https://forums.phpfreaks.com/topic/53603-solved-help/#findComment-264984 Share on other sites More sharing options...
Trium918 Posted May 30, 2007 Author Share Posted May 30, 2007 I am just trying to select * the images belonging to that user and diplay all of the images. Five to each row. There is a googd example of this in the FAQ/Code snippet repo forum. Thanks, it actually works! Quote Link to comment https://forums.phpfreaks.com/topic/53603-solved-help/#findComment-265057 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.