Re: Creating a Table to line query results in php?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks....I was trying to do that but was not working for me. I think
I was over thinking it.

The obvious is never obvious :)

On 2/25/07, Matt Anderton <manderton@xxxxxxxxx> wrote:
why not just create a table?

echo "<table>\n";
echo
"<tr><th>Image</th><th>Name</th><th>Effect</th><th>Category</th><th>Origin</th></tr>\n";
while ($data = mysql_fetch_array($res))
{
  echo "<tr>\n";
  echo "<tr>" . $data['Image'] . "</tr>\n";
  echo "<tr>" . $data['Name'] . "</tr>\n";
  echo "<tr>" . $data['Effect'] . "</tr>\n";
  echo "<tr>" . $data['Category'] . "</tr>\n";
  echo "<tr>" . $data['Origin'] . "</tr>\n";
  echo "</tr>\n";
}
echo "</table>\n";


Or am I oversimplifying?

~ matt




On 2/25/07, Scott <sburcky@xxxxxxxxx> wrote:
>
> Hi everyone!
>
> How can I create a table...or even something similar...to line information
up?
>
> The information is coming from an mysql database and there are 5
> columns of data.
>
> Of course I am using php to call the data out of the database.
>
> A simple example:
>
> while ($data = mysql_fetch_array($res))
> {
>         $idfield = $data['IDFIELD'];
>         $name = $data['Name'];
>         $effect = $data['Effect'];
>         $category = $data['Category'];
>         $origin = $data['Origin'];
>         $image = $data['Image'];
>
> echo "<img src=\"image/$image\">, $name, $effect, $category, $origin<br>";
> }
>
> The echo is the stuff I want to line up under the headings of the
> columns when they are displayed.
>
> So there are 5 headers and under the 5 headers is the resulting
> display of info and I want it lined up, centered, under the headers.
>
> Does that all make sense?
>
> Thanks for all of your time!
>
> S
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>




--
Scott Burcky
AOL IM: Jestrix1

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux