On Wed, 2009-05-20 at 19:20 -0400, PJ wrote:
> Ashley Sheridan wrote:
> > On Wed, 2009-05-20 at 17:47 -0400, PJ wrote:
> >   
> >> Forgot: you can get an idea of what I'm trying to do at
> >> http://www.chiccantine.com/preview.html
> >> -- 
> >> Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
> >> -------------------------------------------------------------
> >> Phil Jourdan --- p...@ptahhotep.com
> >>    http://www.ptahhotep.com
> >>    http://www.chiccantine.com/andypantry.php
> >>
> >>
> >>
> >>     
> > The link you gave doesn't exist online, I'm getting a 404. What do you
> > mean by a list in columns? Do you want a mysql select to be output as
> > several columns of data, or one column per select?
> >   
> :-[  sorry bout that... should have checked - was working with my mouth
> & not my brain.
> 
> It works now. I forgot to upload.
> hadn't thought about how many columns per select... ???
> 
> -- 
> Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
> -------------------------------------------------------------
> Phil Jourdan --- p...@ptahhotep.com
>    http://www.ptahhotep.com
>    http://www.chiccantine.com/andypantry.php
> 
> 
So you want the sql select to be dumped into a table as it exists in the
database?

There is  a simple way to do this, if you know which fields are in your
table, and that is just to use a while loop to iterate your records, and
then explicitly output each field as you want it. This is the preferred
way, and how I'd do it if I were you.

print '<table>';
// put column headers here
$query = "query here";
$result = mysql_query($query);
while($row = mysql_fetch_array($result))
{
    print  '<tr>';
        print "<td>{$row['field1'])</td>";
        print "<td>{$row['field2'])</td>";
        print "<td>{$row['field3'])</td>";
        // etc
    print '</tr>';
}
print '</table>';


Ash
www.ashleysheridan.co.uk


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

Reply via email to