freakstyling Posted March 13, 2012 Share Posted March 13, 2012 Hi guys, I´m having huge problems with my .php . Spend already a couple of days messing with the code, but can´t get it solved. When I use IE or Safari, the script works correctly and everything is displayed like it should. But not with Chrome or Firefox. This is the .php code: <?php $query="SELECT * FROM NEW WHERE lang = '$_lang' AND visible = '1' ORDER BY sort DESC"; $result = mysql_query($query, $conexion); while ($row = mysql_fetch_array($result, $result_type = MYSQL_NUM)) { echo "<h2>$row[1]<span class='black'>"." ".$row[2]."</span></h2> <hr class='red'> <div class='newsitem'> <div class='image'> <a href='new.php?new=$row[0]&parties=1'><img src='$row[7]?r=$_version'></a> </div> <div class='text'>$row[9]</div> <div class='more'> <a href='new.php?new=$row[0]&parties=1'>READ MORE</a> </div> <div class='clear'></div> </div>"; } ?> Can someone already see any mistakes in this, or should I post more? Thank you very much for your help! Laurens Quote Link to comment https://forums.phpfreaks.com/topic/258823-help-only-displays-with-safari-and-ie-not-with-chrome-or-firefox/ Share on other sites More sharing options...
The Little Guy Posted March 13, 2012 Share Posted March 13, 2012 There is no php mistake, when it displays wrong in one browser but not another that is an html/css issue. Quote Link to comment https://forums.phpfreaks.com/topic/258823-help-only-displays-with-safari-and-ie-not-with-chrome-or-firefox/#findComment-1326822 Share on other sites More sharing options...
Muddy_Funster Posted March 13, 2012 Share Posted March 13, 2012 what is an <hr class='red> and why is it not closed? Quote Link to comment https://forums.phpfreaks.com/topic/258823-help-only-displays-with-safari-and-ie-not-with-chrome-or-firefox/#findComment-1326830 Share on other sites More sharing options...
freakstyling Posted March 13, 2012 Author Share Posted March 13, 2012 Thank you for your reply´s! the <hr class='red'> is to define a red line, that´s all. I don´t know if i´m supposed to close it actually... I just put my page through the validator, and yes, I get some/actually loads of errors. Is a page supposed to be completely error-free? Someone has any experience with something similar, or any ideas where I should start correcting errors? Thanks again! Laurens Quote Link to comment https://forums.phpfreaks.com/topic/258823-help-only-displays-with-safari-and-ie-not-with-chrome-or-firefox/#findComment-1326836 Share on other sites More sharing options...
The Little Guy Posted March 13, 2012 Share Posted March 13, 2012 <hr>'s are closed like this: <hr class='red' /> pages should be as error free as possible, the less errors you have the more cross browser friendly they are. Quote Link to comment https://forums.phpfreaks.com/topic/258823-help-only-displays-with-safari-and-ie-not-with-chrome-or-firefox/#findComment-1326839 Share on other sites More sharing options...
scootstah Posted March 13, 2012 Share Posted March 13, 2012 the <hr class='red'> is to define a red line, that´s all. I don´t know if i´m supposed to close it actually... You are supposed to close it, like this: <hr class="red" /> So what exactly is not displaying properly? Is your site live so we can see it? If not, can you post screenshots of the results and the expected results? Quote Link to comment https://forums.phpfreaks.com/topic/258823-help-only-displays-with-safari-and-ie-not-with-chrome-or-firefox/#findComment-1326840 Share on other sites More sharing options...
litebearer Posted March 13, 2012 Share Posted March 13, 2012 Is a page supposed to be completely error-free? Only if you want it to work properly. Quote Link to comment https://forums.phpfreaks.com/topic/258823-help-only-displays-with-safari-and-ie-not-with-chrome-or-firefox/#findComment-1326841 Share on other sites More sharing options...
Muddy_Funster Posted March 13, 2012 Share Posted March 13, 2012 everything you open needs to be closed....everything. some browsers are more tollerent of unclosed tags than others.... in html5 and xhtml hr is a self closing tag, as in <hr calss='red' /> I'm not sure about html 4.x I'm just not sure why you are using a rigid <hr/> when you have divs flying about the place already. also, as far as the validator goes, it's best practice to conform to the w3c standard, but if you don't it doesn't meed that your page won't work. Quote Link to comment https://forums.phpfreaks.com/topic/258823-help-only-displays-with-safari-and-ie-not-with-chrome-or-firefox/#findComment-1326843 Share on other sites More sharing options...
Pikachu2000 Posted March 13, 2012 Share Posted March 13, 2012 Tags are only explicitly closed like that when using an XHTML doctype. Quote Link to comment https://forums.phpfreaks.com/topic/258823-help-only-displays-with-safari-and-ie-not-with-chrome-or-firefox/#findComment-1326849 Share on other sites More sharing options...
scootstah Posted March 13, 2012 Share Posted March 13, 2012 Tags are only explicitly closed like that when using an XHTML doctype. I just tested a bunch of doctypes and got the following results: HTML5 Accepts both <hr> and <hr /> HTML 4.01 Transitional Throws warning with <hr /> HTML 4.01 Strict Throws error with <hr /> XHTML 1.0 Transitional, Strict, and XHTML 1.1 Throws error with <hr> Nifty. I always thought the ending tag was optional for HTML 4.01. Quote Link to comment https://forums.phpfreaks.com/topic/258823-help-only-displays-with-safari-and-ie-not-with-chrome-or-firefox/#findComment-1326853 Share on other sites More sharing options...
Muddy_Funster Posted March 13, 2012 Share Posted March 13, 2012 Tags are only explicitly closed like that when using an XHTML doctype. according to http://dev.w3.org/html5/markup/hr.html it is a void tag without an end tag, and thus can be self closing in html5 as well. still, you would be better using a div as the color atribute for <hr> is depreciated as of html5 Quote Link to comment https://forums.phpfreaks.com/topic/258823-help-only-displays-with-safari-and-ie-not-with-chrome-or-firefox/#findComment-1326855 Share on other sites More sharing options...
freakstyling Posted March 13, 2012 Author Share Posted March 13, 2012 Loads of thank you´s for your reply´s guys! I´m now fixing all the errors which gives the validator. I´ve put all the end tags on the <hr class> tags. Altough not always necessary, better to always do it, right? Let me try to fix my problem by working out all these errors I got from validator. About using the <hr> tags, I know, better to put them in the div´s. Will do that in time... Again, thanx! Quote Link to comment https://forums.phpfreaks.com/topic/258823-help-only-displays-with-safari-and-ie-not-with-chrome-or-firefox/#findComment-1326864 Share on other sites More sharing options...
scootstah Posted March 13, 2012 Share Posted March 13, 2012 still, you would be better using a div as the color atribute for <hr> is depreciated as of html5 <hr> isn't deprecated, it's just different. Instead of a horizontal rule it is now a "paragraph-level thematic break". Quote Link to comment https://forums.phpfreaks.com/topic/258823-help-only-displays-with-safari-and-ie-not-with-chrome-or-firefox/#findComment-1326867 Share on other sites More sharing options...
Muddy_Funster Posted March 13, 2012 Share Posted March 13, 2012 still, you would be better using a div as the color atribute for <hr> is depreciated as of html5 <hr> isn't deprecated, it's just different. Instead of a horizontal rule it is now a "paragraph-level thematic break". I never said <hr> was depreciated, just that the color attribute for it was... Quote Link to comment https://forums.phpfreaks.com/topic/258823-help-only-displays-with-safari-and-ie-not-with-chrome-or-firefox/#findComment-1326907 Share on other sites More sharing options...
scootstah Posted March 13, 2012 Share Posted March 13, 2012 still, you would be better using a div as the color atribute for <hr> is depreciated as of html5 <hr> isn't deprecated, it's just different. Instead of a horizontal rule it is now a "paragraph-level thematic break". I never said <hr> was depreciated, just that the color attribute for it was... Ah, my bad then. Quote Link to comment https://forums.phpfreaks.com/topic/258823-help-only-displays-with-safari-and-ie-not-with-chrome-or-firefox/#findComment-1326909 Share on other sites More sharing options...
freakstyling Posted March 13, 2012 Author Share Posted March 13, 2012 Alright, back to why I actually started this topic. Solved loads of errors, and had a good look at the rest, but don´t think I can solve my problem by working all these errors out. Link is: www.ushuaiaibiza.com , have a look... in IE and on mac, you´ll get to see the news item, but not in Chrome or Firefox. Anyone has an idea?! Thanks again! Quote Link to comment https://forums.phpfreaks.com/topic/258823-help-only-displays-with-safari-and-ie-not-with-chrome-or-firefox/#findComment-1326911 Share on other sites More sharing options...
scootstah Posted March 13, 2012 Share Posted March 13, 2012 I've tried with IE, Firefox and Chrome (on Win7) and none of them show a news article. Perhaps the reason you can on one browser is because it is cached? I would check that you are actually getting data from the database. Quote Link to comment https://forums.phpfreaks.com/topic/258823-help-only-displays-with-safari-and-ie-not-with-chrome-or-firefox/#findComment-1326930 Share on other sites More sharing options...
freakstyling Posted March 13, 2012 Author Share Posted March 13, 2012 Very strange... I´ve tried changing the username and password, just to be sure. Also adding the port after the localhost. Still worked in IE, but not in the rest. I´m also working on win7, and have the latest versions of the browsers. Strange your IE doesn´t show. Also tried to put nothing as username and password, just ´root´, but then it didn´t do anything. Also not in IE, so it isn´t cache, otherwise it would display, even though it couldn´t get anything from the database. What´s the best way to check the database? Thanks again for the help! Quote Link to comment https://forums.phpfreaks.com/topic/258823-help-only-displays-with-safari-and-ie-not-with-chrome-or-firefox/#findComment-1326952 Share on other sites More sharing options...
scootstah Posted March 13, 2012 Share Posted March 13, 2012 Something like $query="SELECT * FROM NEW WHERE lang = '$_lang' AND visible = '1' ORDER BY sort DESC"; $result = mysql_query($query, $conexion); while ($row = mysql_fetch_array($result, $result_type = MYSQL_NUM)) { echo '<pre>' . print_r($row, true) . '</pre>'; } Quote Link to comment https://forums.phpfreaks.com/topic/258823-help-only-displays-with-safari-and-ie-not-with-chrome-or-firefox/#findComment-1326964 Share on other sites More sharing options...
freakstyling Posted March 13, 2012 Author Share Posted March 13, 2012 IT´S SOLVED!!! The problem was that i´ve got all the posts set on language. My IE was displaying the spanish version, which was in the database. The rest the english version, which wasn´t in the database. So now a favor, if anyone has time, could you go to ushuaiaibiza.com to see if the news item comes up. Also press it to see if the link works. Btw the text is in spanish. And Thank You Very Much For The Help! You´re Great!!! All of you! If I have another problem, I know where to post... Cheers! I´m so happy it works! Quote Link to comment https://forums.phpfreaks.com/topic/258823-help-only-displays-with-safari-and-ie-not-with-chrome-or-firefox/#findComment-1326966 Share on other sites More sharing options...
mikosiko Posted March 13, 2012 Share Posted March 13, 2012 so.. everyone here won a free party ticket? OT: just curiosity... "pinchará" is a regular word in that business or just an inaccurate translation? Quote Link to comment https://forums.phpfreaks.com/topic/258823-help-only-displays-with-safari-and-ie-not-with-chrome-or-firefox/#findComment-1326977 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.