ItsWesYo Posted July 5, 2006 Share Posted July 5, 2006 http://www.evermoreforums.com/wes/items/index.phpI would like 3 items per row/line.I saw somewhere you can do that using php echoes.But I don't know how to do that.Your help is greatly appreciated. Link to comment https://forums.phpfreaks.com/topic/13700-php-echo/ Share on other sites More sharing options...
trq Posted July 5, 2006 Share Posted July 5, 2006 See [url=http://www.phpfreaks.com/forums/index.php/topic,95426.0.html]here[/url]. Link to comment https://forums.phpfreaks.com/topic/13700-php-echo/#findComment-53161 Share on other sites More sharing options...
ItsWesYo Posted July 5, 2006 Author Share Posted July 5, 2006 Hmm. Well, here is what my code is:[code]<?mysql_connect("localhost","usernameHIDDEN","passwordHIDDEN"); mysql_select_db("tableHIDDEN"); $result = mysql_query("SELECT * FROM items ORDER BY name");while($r=mysql_fetch_array($result)){ $name=$r["name"];echo "$name<br>";}?>[/code] Link to comment https://forums.phpfreaks.com/topic/13700-php-echo/#findComment-53170 Share on other sites More sharing options...
trq Posted July 5, 2006 Share Posted July 5, 2006 And? See [url=http://www.phpfreaks.com/forums/index.php/topic,95426.0.html]here[/url]. Link to comment https://forums.phpfreaks.com/topic/13700-php-echo/#findComment-53171 Share on other sites More sharing options...
ItsWesYo Posted July 5, 2006 Author Share Posted July 5, 2006 I'm not talking about that kind >_>I saw one last time that was like:[code]echo " <tr> ";echo "<td>";[/code]Something like that. Link to comment https://forums.phpfreaks.com/topic/13700-php-echo/#findComment-53175 Share on other sites More sharing options...
trq Posted July 5, 2006 Share Posted July 5, 2006 The example Im pointing out is how it is done. Link to comment https://forums.phpfreaks.com/topic/13700-php-echo/#findComment-53178 Share on other sites More sharing options...
mrwhale Posted July 5, 2006 Share Posted July 5, 2006 This should work.[code]<?phpmysql_connect( "localhost", "usernameHIDDEN", "passwordHIDDEN" ); mysql_select_db( "tableHIDDEN" );$query = mysql_query( "SELECT * FROM items ORDER BY name" );echo "<table>";while( $row = mysql_fetch_array( $query ) ){ $x++; if( $x == 1 ) echo "<tr>"; echo "<td>" . $row['name'] . "</td>"; if( $x == 3 ) { echo "</tr>"; $x = 0; }}echo "<table>";?>[/code] Link to comment https://forums.phpfreaks.com/topic/13700-php-echo/#findComment-53229 Share on other sites More sharing options...
ItsWesYo Posted July 5, 2006 Author Share Posted July 5, 2006 Thanks to both of you.It worked.Thorpe -- It wasn't I didn't understand it, I just needed to incorporate it into mine =\ Link to comment https://forums.phpfreaks.com/topic/13700-php-echo/#findComment-53252 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.