sam_h Posted September 28, 2008 Share Posted September 28, 2008 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 Quote Link to comment https://forums.phpfreaks.com/topic/126182-validation-issue-because-of-php-i-think/ Share on other sites More sharing options...
wildteen88 Posted September 28, 2008 Share Posted September 28, 2008 Its is not PHP causing it. Its you. PHP does what it gets told to do. We can't really suggest anything until we actually see your code that is causing the issue. Quote Link to comment https://forums.phpfreaks.com/topic/126182-validation-issue-because-of-php-i-think/#findComment-652520 Share on other sites More sharing options...
sam_h Posted September 28, 2008 Author Share Posted September 28, 2008 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>'; ?> Quote Link to comment https://forums.phpfreaks.com/topic/126182-validation-issue-because-of-php-i-think/#findComment-652529 Share on other sites More sharing options...
CroNiX Posted September 28, 2008 Share Posted September 28, 2008 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’s what a lot of Arsenal fans were hoping for….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’m not saying that I think the two can be compared…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. Quote Link to comment https://forums.phpfreaks.com/topic/126182-validation-issue-because-of-php-i-think/#findComment-652559 Share on other sites More sharing options...
DarkWater Posted September 28, 2008 Share Posted September 28, 2008 In which case htmlentities() should be used anyway. Quote Link to comment https://forums.phpfreaks.com/topic/126182-validation-issue-because-of-php-i-think/#findComment-652564 Share on other sites More sharing options...
sam_h Posted September 29, 2008 Author Share Posted September 29, 2008 I did have a look a the error reports, but wasn't sure how to close a div tag that I didn't create manually? what are htmlentities darkwater? Quote Link to comment https://forums.phpfreaks.com/topic/126182-validation-issue-because-of-php-i-think/#findComment-652826 Share on other sites More sharing options...
sam_h Posted October 3, 2008 Author Share Posted October 3, 2008 well i found the missing /div tag and it now validates fine thanks for your help Quote Link to comment https://forums.phpfreaks.com/topic/126182-validation-issue-because-of-php-i-think/#findComment-656318 Share on other sites More sharing options...
jordanwb Posted October 3, 2008 Share Posted October 3, 2008 what are htmlentities darkwater? http://ca.php.net/manual/en/function.htmlentities.php Quote Link to comment https://forums.phpfreaks.com/topic/126182-validation-issue-because-of-php-i-think/#findComment-656689 Share on other sites More sharing options...
waynew Posted October 3, 2008 Share Posted October 3, 2008 Just kill it with fire. Quote Link to comment https://forums.phpfreaks.com/topic/126182-validation-issue-because-of-php-i-think/#findComment-656690 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.