Creating a Table to line query results in php?

Creating a Table to line query results in php?

am 25.02.2007 12:52:11 von scott

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 ", $name, $effect, $category, $origin
";
}

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

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

am 26.02.2007 00:25:43 von dmagick

Scott wrote:
> Hi everyone!
>
> How can I create a table...or even something similar...to line
> information up?

Use a table? http://www.w3schools.com/html/html_tables.asp

--
Postgresql & php tutorials
http://www.designmagick.com/

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

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

am 26.02.2007 03:00:55 von scott

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 wrote:
> why not just create a table?
>
> echo "

\n";
> echo
> "\n";
> while ($data = mysql_fetch_array($res))
> {
> echo "\n";
> echo "" . $data['Image'] . "\n";
> echo "" . $data['Name'] . "\n";
> echo "" . $data['Effect'] . "\n";
> echo "" . $data['Category'] . "\n";
> echo "" . $data['Origin'] . "\n";
> echo "\n";
> }
> echo "
ImageNameEffectCategoryOrigin
\n";
>
>
> Or am I oversimplifying?
>
> ~ matt
>
>
>
>
> On 2/25/07, Scott 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 ", $name, $effect, $category, $origin
";
> > }
> >
> > 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

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

am 26.02.2007 03:13:24 von dmagick

Scott wrote:
> 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 wrote:
>> why not just create a table?
>>
>> echo "

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

The middle ones should be 's:

echo "\n";
echo "" . $data['Image'] . "\n";
echo "" . $data['Name'] . "\n";
echo "" . $data['Effect'] . "\n";
echo "" . $data['Category'] . "\n";
echo "" . $data['Origin'] . "\n";
echo "\n";

--
Postgresql & php tutorials
http://www.designmagick.com/

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

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

am 01.03.2007 14:41:43 von datsclark

You could also just use CSS. Make each column in a div and line them up
that way. Might not be as simple as a table right off-the-bat, but if you
have to make any changes later, its often easier.

A quick google search shows tons of tutorials on tables in css.
http://css.nu/articles/table-in-css.html


"Scott" wrote in message
news:c96bd0160702250352q15e0b18fob823c681a7e756e7@mail.gmail .com...
> 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 ", $name, $effect, $category, $origin
";
> }
>
> 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

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

am 03.03.2007 14:43:22 von Haydar TUNA

Hello,
You can use HTML

tag. if you change your echo line in the
code below, may be your problem will be fixed :)

--
Haydar TUNA
Republic Of Turkey - Ministry of National Education
Education Technology Department Ankara / TURKEY
Web: http://www.haydartuna.net

"Scott" , haber iletisinde sunlari
yazdi:c96bd0160702250352q15e0b18fob823c681a7e756e7@mail.gmai l.com...
> 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 ", $name, $effect, $category, $origin
";
> }
>
> 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

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

am 03.03.2007 14:54:48 von Brad Bonkoski

>How can I create a table...or even something similar...to line information
> up?


echo "

";
echo "";

>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 ", $name, $effect, $category, $origin
";

echo "";

> }
echo "
Header1Header2Header N
$name$effect$category$origin
";

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