Jump to content

Archived

This topic is now archived and is closed to further replies.

ItsWesYo

PHP Echo

Recommended Posts

http://www.evermoreforums.com/wes/items/index.php

I 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.

Share this post


Link to post
Share on other sites
See [url=http://www.phpfreaks.com/forums/index.php/topic,95426.0.html]here[/url].

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
And? See [url=http://www.phpfreaks.com/forums/index.php/topic,95426.0.html]here[/url].

Share this post


Link to post
Share on other sites
I'm not talking about that kind >_>

I saw one last time that was like:

[code]echo " <tr> ";
echo "<td>";[/code]

Something like that.

Share this post


Link to post
Share on other sites
The example Im pointing out is how it is done.

Share this post


Link to post
Share on other sites
This should work.

[code]<?php

mysql_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]

Share this post


Link to post
Share on other sites
Thanks to both of you.

It worked.

Thorpe -- It wasn't I didn't understand it, I just needed to incorporate it into mine =\

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.