Jump to content

Recommended Posts

I have a code that outputs a table but right now each result is under the next ex:

 

1

2

3

1

2

3

I would like them to be horizontal ex:

123

123

 

the part of the code the controls the table is:

echo "<table border=0 cellspacing=0 cellpadding=0>";
foreach($xml->result->rowset->row AS $name)
{
echo "<tr>";
echo "<td><img src=/Character/".$name['characterID']."_200.jpg></td></tr>";
echo "<tr><td>".ucwords($name['name'])."</td></tr>";
echo "<tr><td>".ucwords($name['corporationName'])."</td>";
echo "</tr>";
}
echo "</table>";

Link to comment
https://forums.phpfreaks.com/topic/233864-arranging-table-horizontal/
Share on other sites

They're on separate lines because of the <tr>'s. Remove those so it look like this:

echo "<tr>";
echo "<td><img src=/Character/".$name['characterID']."_200.jpg></td>";
echo "<td>".ucwords($name['name'])."</td>";
echo "<td>".ucwords($name['corporationName'])."</td>";
echo "</tr>";

This is what I came up with it works, but is there a better way to do it?

 

echo "<table border=0 cellspacing=0 cellpadding=0>";

echo "<tr>";

foreach($xml->result->rowset->row AS $name)

{

echo "<td><img src=http://image.eveonline.com/Character/".$name['characterID']."_200.jpg></td>";

}

echo "<tr>";

foreach($xml->result->rowset->row AS $name)

{

echo "<td>".ucwords($name['name'])."</td>";

}

echo "</tr>";

echo "<tr>";

foreach($xml->result->rowset->row AS $name)

{

echo "<td>".ucwords($name['corporationName'])."</td>";

}

echo "</tr>";

}

echo "</tr>";

echo "</table>";

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.