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. Quote 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]. Quote 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] Quote 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]. Quote 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. Quote 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. Quote 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] Quote 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 =\ Quote Link to comment https://forums.phpfreaks.com/topic/13700-php-echo/#findComment-53252 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.