PHP and XML vs PHP and XHTML

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jwgrafflin
    New Member
    • Mar 2008
    • 7

    PHP and XML vs PHP and XHTML

    The following code works just fine on my
    Code:
    <!DOCTYPE html PUBLIC
    "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    page, but won't work on my
    Code:
    ?xml version="1.0" encoding="utf-8"?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" >
    page. Plus, it delivers 9 validation errors that I don't know how to handle, and one caution.[code=php]<div class="colmask fullpage">
    <div class="col1">

    <!-- Start Content -->

    <?php
    include("dbinfo .inc.php");
    $query="SELECT * FROM webhosts ORDER BY progname ASC";
    $result=mysql_q uery($query)or die(mysql_error ());
    $num=mysql_numr ows($result);
    $i=0;
    mysql_close();
    ?>

    <table>
    <tr>
    <th>Host Name</th>
    <th>Established </th>
    <th>Price</th>
    <th>Disk Space</th>
    <th>Bandwidth </th>
    <th>Economy Plan Available</th>
    <th>Allows Mailing Lists</th>
    <th>Server Platform</th>
    <th>SSL Included</th>
    <th>eCommerce Ready</th>
    <th>Affiliate Program</th>
    </tr>

    <?php
    while ($i < $num) {
    $hostname=mysql _result($result ,$i,"hostname") ;
    $url=mysql_resu lt($result,$i," url");
    $established=my sql_result($res ult,$i,"establi shed");
    $price=mysql_re sult($result,$i ,"price");
    $diskspace=mysq l_result($resul t,$i,"diskspace ");
    $bandwidth=mysq l_result($resul t,$i,"bandwidth ");
    $econplan=mysql _result($result ,$i,"econplan") ;
    $maillists=mysq l_result($resul t,$i,"maillists ");
    $platform=mysql _result($result ,$i,"platform") ;
    $ssl=mysql_resu lt($result,$i," ssl");
    $ecommerce=mysq l_result($resul t,$i,"ecommerce ");
    $affiliate=mysq l_result($resul t,$i,"affiliate ");
    ?>
    <tr>
    <td><a href="<?php echo $url; ?>"><?php echo $hostname; ?></a></td>
    <td><?php echo $established; ?></td>
    <td><?php echo $diskspace; ?></td>
    <td><?php echo $bandwidth; ?></td>
    <td><?php echo $econplan; ?></td>
    <td><?php echo $maillists; ?></td>
    <td><?php echo $platform; ?></td>
    <td><?php echo $ssl; ?></td>
    <td><?php echo $ecommerce; ?></td>
    <td><?php echo $affiliate; ?></td>
    </tr>
    <?php
    ++$i;
    }
    ?>
    </table>

    <!-- End Content -->

    </div>
    </div>[/code]

    The errors delivered are as follows:

    Line 86, Column 20: character "<" is the first character of a delimiter but occurred as data.
    <td><a href="<?php echo $url; ?>"><?php echo $hostname; ?></a></td>✉
    This message may appear in several cases:

    You tried to include the "<" character in your page: you should escape it as "&lt;"
    You used an unescaped ampersand "&": this may be valid in some contexts, but it is recommended to use "&amp;", which is always safe.
    Another possibility is that you forgot to close quotes in a previous tag.

    Line 86, Column 20: XML Parsing Error: Unescaped '<' not allowed in attributes values.
    <td><a href="<?php echo $url; ?>"><?php echo $hostname; ?></a></td>✉
    Line 86, Column 20: XML Parsing Error: attributes construct error.
    <td><a href="<?php echo $url; ?>"><?php echo $hostname; ?></a></td>✉
    Line 86, Column 20: XML Parsing Error: Couldn't find end of Start Tag a line 86.
    <td><a href="<?php echo $url; ?>"><?php echo $hostname; ?></a></td>✉
    Line 86, Column 69: XML Parsing Error: Opening and ending tag mismatch: td line 86 and a.
    …?php echo $url; ?>"><?php echo $hostname; ?></a></td>✉
    Line 86, Column 74: XML Parsing Error: Opening and ending tag mismatch: tr line 85 and td.
    …$url; ?>"><?php echo $hostname; ?></a></td>✉
    Line 96, Column 11: XML Parsing Error: Opening and ending tag mismatch: table line 55 and tr.
    </tr>✉
    Line 101, Column 10: XML Parsing Error: Opening and ending tag mismatch: div line 42 and table.
    </table>✉
    Line 106, Column 6: XML Parsing Error: Opening and ending tag mismatch: body line 27 and div.
    </div>✉
    Line 168, Column 7: XML Parsing Error: Opening and ending tag mismatch: html line 3 and body.
    </body>
    Last edited by ronverdonk; Mar 14 '08, 11:58 PM. Reason: code tags!!
  • ronverdonk
    Recognized Expert Specialist
    • Jul 2006
    • 4259

    #2
    What do you mean by XML page? What does that look like?. And what are these errors?

    Ronald

    Comment

    • jwgrafflin
      New Member
      • Mar 2008
      • 7

      #3
      Golly gee whiz Batman. I got the darned thing to validate on my own. Problem is, still no output, or at least not the output I intended.

      Go to [REMOVED] to see what I mean.

      To view the results of the same code on the other website (the one using xhtml transitional) go to [REMOVED]

      Different database used on this second website (above).

      I even tried changing the doctype of the first page to the same as the other, but still no output as desired. Could it be a CSS error? The first page is written using CSS, while the second uses the old table formatting.

      Just give me a nudge in the right direction, that's all I'm asking.
      Last edited by ak1dnar; Mar 15 '08, 06:20 AM. Reason: Commercial web site links removed

      Comment

      • jwgrafflin
        New Member
        • Mar 2008
        • 7

        #4
        Sorry about the links. Didn't read the Reply Guidelines. Was just trying to give you complete information. No offense intended.

        Comment

        Working...