#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2000
    Posts
    24
    Rep Power
    0
    I'm tring to format output from a mysql table in html table fromat. I'm using the statement below and am having trouble with formating specifically the table width, border width, etc. My code is:


    $result = mysql_query("SELECT * FROM events order by Name ASC",$db);
    while ($myrow = mysql_fetch_array($result)) {


    printf("<table><tr><td width="25%"><a href="%s?id=%s">%s</td> <td>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> </a> n ", $PHP_SELF, $myrow["ID"], $myrow["Name"], $myrow["Address1"], $myrow["Address2"], $myrow["City"], $myrow["State"], $myrow["Phone1"]);

    printf("<td><a href="%s?id=%s&delete=yes">(DELETE)</a></td></tr></table>", $PHP_SELF, $myrow["ID"]);
    }
    --------------------------------------

    In html it should be something like:
    <table border="1" width="100%">
    <tr>
    <td width="25%">&nbsp;</td>
    <td width="25%">&nbsp;</td>
    <td width="25%">&nbsp;</td>
    <td width="25%">&nbsp;</td>
    </tr>
    </table>


    Could someone please help?

    Thanks in advance.
    Bob


  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2000
    Posts
    79
    Rep Power
    15
    firstly
    <td width="25%"> should be <td width="25%">
    You only need backslashes before rabbits ears and i think apostrophies.

    Also..
    You dont need the quotes when u type $row["fieldname"]. $row[fieldname] should work fine.

    Basil

Similar Threads

  1. How to create HTML email with PHP?
    By bubbapuck in forum PHP Development
    Replies: 4
    Last Post: March 8th, 2004, 07:48 PM
  2. Can php be used in html files
    By emzyme in forum PHP Development
    Replies: 3
    Last Post: January 29th, 2004, 02:50 PM
  3. all-in-one php script displaying html
    By emzyme in forum PHP Development
    Replies: 5
    Last Post: January 27th, 2004, 08:07 AM
  4. php n00b. Put a php file into an html template?
    By WorldBuilder in forum PHP Development
    Replies: 3
    Last Post: January 25th, 2004, 09:48 PM
  5. Using tables in php
    By reluxoflife in forum PHP Development
    Replies: 1
    Last Post: January 19th, 2004, 03:41 PM

IMN logo majestic logo threadwatch logo seochat tools logo