Jump to content

Validation Issue Because of PHP (i think!)


sam_h

Recommended Posts

Hi all,

 

I'm just looking through some validation issues for my site. On of my PHP pages has 66 Errors all of which occur because of an RSS feed I have called with PHP...at least I think that is the issue!

 

It would appear that the output of my page ommits the closing div tag for each headline/story in my feed...

 

If anyone has any ideas how to correct this, it would be greatly appreciated!

 

Regards, Sam

Link to comment
Share on other sites

yep that is most definitely right! i am only new to the php ropes, so bear with me!

 

the page that I am in reference to is onyahead.com/latestnews.php

 

and the PHP that i used there is the following:

 

<?php
$host = "localhost";
$username = "*******";
$password = "*******";
$con = mysql_connect($host,$username,$password) or die ("cannot connect");


$databases = array(
'onyahe_wrdp1',
'onyahe_wrdp2',
'onyahe_wrdp3'
);


echo '<table><tbody>';

    foreach($databases as $database){
        $q = mysql_query("SELECT u.user_nicename , (SELECT COUNT(*) FROM {$database}.wp_posts WHERE post_author=u.ID AND post_type = 'post') AS posts FROM {$database}.wp_posts AS p LEFT JOIN {$database}.wp_users AS u ON u.ID = p.post_author WHERE p.post_type = 'post' GROUP BY p.post_author ORDER BY posts DESC LIMIT 1") or die ("<tr><td>Error:</td><td>Unable to run query on db: ".$database."</td></tr>");
            $a = mysql_fetch_assoc($q);
            echo '<tr><td><strong>'.$a['user_nicename'].'</strong> has written</td><td><strong>'.$a['posts'].'</strong> articles </td></tr>';
    }

echo '</tbody></table>';
?> 

 

 

Link to comment
Share on other sites

Did you even read the error messages that the validator gave you?

 

Just about all of them say:

Line 154, Column 6: end tag for "div" omitted, but OMITTAG NO was specified.

 

If you look at the source of your page, there are a lot of lines similar to this:

<div><p><a href="http://onyahead.com/arsenal/2008/08/adebayor-back-in-business/">Adebayor Back In Business</a></p><p>It&#8217;s what a lot of Arsenal fans were hoping for&#8230;.a new contract swiftly followed by a big performance from our frontman.
He is slowly but surely beginning to ooze with a confidence and class reminiscent of what we once experienced when watching Henry.
Now I&#8217;m not saying that I think the two can be compared&#8230;because they are [...]</p>

See?  There is no </div> at the end of all of those lines.

In the code you posted above, it uses a table and no divs, so the problem isn't occurring within that code, unless its in the database data being retrieved.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.