Results 1 to 7 of 7

Thread: Evil tables!

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jul 2003
    Posts
    255

    Evil tables!

    Okay, so here's the problem (it's writtin in PHP...so..whatever):
    My code (below) to display a entries in a table is fine..I think. When I view the page in Firefox, it's good, BUT when I refresh, with no changes having been made, the bottom 2 (I only have 3 entries at the moment) tables take up 100% width, instead of 80%. The source says 80% as width, however. Now, when I tried this in Internet Explorer, they stayed the same, all fine and dandy. Anyone know what's going on?

    PHP Code:
      $i=0;
      
    $query=mysql_query("SELECT * FROM packagestable") or die(mysql_error());
      
    $num=mysql_num_rows($query);
      
    //echo "\n<br \><br \>";
      
    while($i<$num)
      {
        
    $title=mysql_result($query,$i,"title");
        
    $author=mysql_result($query,$i,"author");
        
    $descr=mysql_result($query,$i,"description");
        
    $price=mysql_result($query,$i,"price");
        
    $lang=mysql_result($query,$i,"language");
        echo 
    "\n\n\n<center \><table width=80% border=1 cellpadding=2 cellspacing=1 \>\n";
        echo 
    "<tr \><td \><font face=verdana size=1 \>Package Name:</td \>\n";
        echo 
    "<td ><font face=verdana size=1 \>" $title "</td \></tr \>\n";
        echo 
    "<tr \><td \><font face=verdana size=1 \>Programmer(s):</td \>\n";
        echo 
    "<td ><font face=verdana size=1 \>" $author "</td \></tr \>\n";
        echo 
    "<tr \><td \><font face=verdana size=1 \>Language(s):</td \>\n";
        echo 
    "<td ><font face=verdana size=1 \>" $lang "</td \></tr \>\n";
        echo 
    "<tr \><td \><font face=verdana size=1 \>Price:</td \>\n";
        echo 
    "<td ><font face=verdana size=1 \>"$price "</a ></td \></tr \>\n";
        echo 
    "<tr \><td \><font face=verdana size=1 \>Description:</td \>\n";
        echo 
    "<td ><font face=verdana size=1 \>"$descr "</td \></tr \>\n";
        echo 
    "<tr \><td \><font face=verdana size=1 \>Order:</td \>\n";
        echo 
    "<td ><a href=\"mailto:[email protected]?subject=Order" $i "\" \>Order Me </td \></tr \>\n";
        echo 
    "</table \></center \><br \><br \><br \>\n";
        
    $i++;
      }
      echo 
    "\n"

  2. #2
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    In HTML, you may only omit quotes around attribute values if the value consists only of alphabetic OR only of numeric characters. A mix of the two or any non-alphanumeric characters require the use of quotes.
    In XHTML, quotes are always mandatory.

    That means that, for valid HTML, you have to do this:
    <table width="80%" border=1 cellpadding=2 cellspacing=1 >
    and for valid XHTML:
    <table width="80%" border="1" cellpadding="2" cellspacing="1" >

    This may or may not be the source of the error.

    Two more things:
    1) mysql_result is not recommended. The mysql_fetch_* functions are far faster and even easier to use in this case.
    2) Your HTML is hopelessly outdated. The use of the <center> and <font> tags is not good. They are deprecated.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jul 2003
    Posts
    255
    Eh...I'll update then, but I'm so used to the old stuff :\

  4. #4
    Frenzied Member ober0330's Avatar
    Join Date
    Dec 2001
    Location
    OH, USA
    Posts
    1,945
    Your old stuff will slowly begin to be removed from future browsers (or at least I hope). Switch now to avoid problems.
    format your code!! - [vbcode] [/vbcode]

    ANSWERS CAN BE FOUND HERE!!

    my personal company

  5. #5
    Junior Member
    Join Date
    Jul 2004
    Posts
    20
    iieew start using templates mate.

  6. #6
    Frenzied Member ober0330's Avatar
    Join Date
    Dec 2001
    Location
    OH, USA
    Posts
    1,945
    This thread is nearly a month old... and you bumped it for that?
    format your code!! - [vbcode] [/vbcode]

    ANSWERS CAN BE FOUND HERE!!

    my personal company

  7. #7
    Hyperactive Member AvisSoft's Avatar
    Join Date
    Sep 2002
    Location
    Chandigarh
    Posts
    459
    Does this helps ?

    PHP Code:
    $query mysql_query("SELECT * FROM packagestable") or die(mysql_error());
    //echo "\n<br><br>";
    while($num mysql_fetch_array($query))
    {

            echo 
    "\n\n\n<center><table width=80% border=1 cellpadding=2 cellspacing=1>\n";
            echo 
    "<tr><td><font face=verdana size=1>Package Name:</td>\n";
            echo 
    "<td><font face=verdana size=1>" $num[title] . "</td></tr>\n";
            echo 
    "<tr><td><font face=verdana size=1>Programmer(s):</td>\n";
            echo 
    "<td><font face=verdana size=1>" $num[author] . "</td></tr>\n";
            echo 
    "<tr><td><font face=verdana size=1>Language(s):</td>\n";
            echo 
    "<td><font face=verdana size=1>" $num[description] . "</td></tr>\n";
            echo 
    "<tr><td><font face=verdana size=1>Price:</td>\n";
            echo 
    "<td><font face=verdana size=1>"$num[price] . "</a></td></tr>\n";
            echo 
    "<tr><td><font face=verdana size=1>Description:</td>\n";
            echo 
    "<td><font face=verdana size=1>"$num[language] . "</td></tr>\n";
            echo 
    "<tr><td><font face=verdana size=1>Order:</td>\n";
            echo 
    "<td><a href=\"mailto:[email protected]?subject=Order" $num "\">Order Me </td></tr>\n";
            echo 
    "</table></center><br><br><br>\n";
    }
    echo 
    "\n"
    Tapan Bhanot,
    CEO, Avis Software.
    Website: www.avissoftware.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width