Re: Table help needed
| From: | tamouse mailing lists | Date: | Sat, 20 Oct 2012 05:52:50 +0000 |
| Subject: | Re: Table help needed | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-319522@lists.php.net to get a copy of this message | ||
On Fri, Oct 19, 2012 at 6:09 PM, admin <admin@buskirkgraphics.com> wrote:
>> -----Original Message-----
>> From: Chris Payne [mailto:oxygenet32@gmail.com]
>> Sent: Friday, October 19, 2012 7:01 PM
>> To: <php-general@lists.php.net>
>> Subject: [PHP] Table help needed
>>
>> Hi everyone,
>>
>> So i'm stuck, and I admit it. I have to (QUICKLY) display information
>> from a database, easy. But the formatting they want is in a HTML
>> table, 3 columns at a time and unlimited rows - how can I display 3
>> columns across at a time? Please help, it's a last minute thing !!!
>>
>> Chris
>
>
> $query = "SELECT * TABLE";
> $result = mysql_query($query);
> If(mysql_num_rows($result) >= 1)
> {
> Echo "<table>";
> While($row = mysql_fetch_assoc($result))
> {
> Echo
>
> "<TR><TD>".$row[field1]."</TD><TD>".$row[field2]."</TD><TD>".$row[field3]."<
> /TD></TR>
> }
> Echo "</table>";
> }
Surprised no one else has jumped on the "Don't use mysql anymore" thing here.
Quick and dirty PDO implementation: https://gist.github.com/3922192