• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 444
  • Last Modified:

This html/php code dosent work correct

Hi!

<div class="art-content-layout">
    <div class="art-content-layout-row">
    <div class="art-layout-cell layout-item-0" style="width: 100%" >
        <p><span style="color: rgb(78, 104, 131); font-size: 24px; line-height: 28px;">
		<?ph

$result3 = mysql_query("SELECT IDNR,sporsmal FROM {$table1} WHERE serie=1") or die(mysql_error());
while ($row3 = mysql_fetch_array($result3)){
    $navntillink = $row3['IDNR'];
	$linken = $row3['sporsmal'];
	echo "<div>$navntillink\"$linken</div>";
}
?>
		</span><br></p>
    </div>
    </div>
</div>
</div>

Open in new window


The code, dosent style this line correct -> echo "<div>$navntillink\"$linken</div>";

And result showing wrong:

1"Finnes det liv p¿ andre planeter ?
2"Er det morro og vere Norsk i Danmark ?
3"Er det skudd¿r hvert ¿r ?

Result must show:

1 Finnes det liv på andre planeter ?
2 Er det morro og vere Norsk i Danmark ?
3 Er det skuddår hvert år ?

How do i fix this ?
0
team2005
Asked:
team2005
  • 6
  • 6
2 Solutions
 
Ray PaseurCommented:
This is a character encoding error.  For some understanding of the issue, please read this article.
http://www.joelonsoftware.com/articles/Unicode.html

Check your character sets.  Are you using UTF-8?  Your character sets must be correct and consistent across all of HTML, PHP and the data base for this to work correctly.
0
 
team2005Author Commented:
Hi!

How about the styling issue ?
0
 
Ray PaseurCommented:
I don't know.  What is the purpose of line 5 in the code snippet above?  That appears to be wrong, but maybe I am missing something here.
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
Jagadishwor DulalBraces MediaCommented:
As Ray write you are using <?ph only in line 5

<?ph

$result3 = mysql_query("SELECT IDNR,sporsmal FROM {$table1} WHERE serie=1") or die(mysql_error());
while ($row3 = mysql_fetch_array($result3)){
    $navntillink = $row3['IDNR'];
	$linken = $row3['sporsmal'];
	echo "<div>$navntillink\"$linken</div>";
}
?>

Open in new window

0
 
team2005Author Commented:
Hi!

Can't use PHP code witout <?php tag ?
0
 
Ray PaseurCommented:
Yes, you should use the <?php tag to start the PHP interpreter.

This: <?php is not the same as this: <?ph

A good book that can help you get a foundation in how all of this stuff works is available here.
http://www.sitepoint.com/books/phpmysql5/
0
 
team2005Author Commented:
Hi!

Sorry, i have written <?php in the code.
But missed p at the end, when i was copy the text from index.php file

Why dosent it use styling -> echo "<div>$navntillink\"$linken</div>";
0
 
Ray PaseurCommented:
I can't tell from here.  Please run the script, use view source in the browser, copy the relevant parts and post the output in the code snippet, thanks.
0
 
team2005Author Commented:
<!DOCTYPE html>

<html dir="ltr" lang="en-US"><head>
    <meta charset="utf-8">
    <title></title>
    <meta name="viewport" content="initial-scale = 1.0, maximum-scale = 1.0, user-scalable = no, width = device-width">

    <!--[if lt IE 9]><script src="https://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
    <link rel="stylesheet" href="style.css" media="screen">
    <!--[if lte IE 7]><link rel="stylesheet" href="style.ie7.css" media="screen" /><![endif]-->
    <link rel="stylesheet" href="style.responsive.css" media="all">


    <script src="jquery.js"></script>
    <script src="script.js"></script>
    <script src="script.responsive.js"></script>


<style>.art-content .art-postcontent-0 .layout-item-0 { padding-right: 10px;padding-left: 10px;  }
.ie7 .art-post .art-layout-cell {border:none !important; padding:0 !important; }
.ie6 .art-post .art-layout-cell {border:none !important; padding:0 !important; }

</style></head>
<body>
<div id="art-main">
    <div class="art-sheet clearfix">
<header class="art-header">


    <div class="art-shapes">

            </div>
<h1 class="art-headline" data-left="1.23%">
    <a href="#">Testside</a>
</h1>



<div class="art-textblock art-object227400126" data-left="97.5%">
    <form class="art-search" name="Search" action="javascript:void(0)">
    <input type="text" value="">
    <input type="submit" value="Search" name="search" class="art-search-button">
</form>
</div>
<nav class="art-nav">
    <ul class="art-hmenu"><li><a href="hjem.html" class="active">Hjem</a></li><li><a href="blog.html">Blog</a></li></ul> 
    </nav>

                    
</header>
<div class="art-layout-wrapper">
                <div class="art-content-layout">
                    <div class="art-content-layout-row">
                        <div class="art-layout-cell art-content"><article class="art-post art-article">
                                <h2 class="art-postheader"></h2>
                                                
                <div class="art-postcontent art-postcontent-0 clearfix"><div class="art-content-layout">
    <div class="art-content-layout-row">
    <div class="art-layout-cell layout-item-0" style="width: 50%" >
        <p><span style="color: rgb(78, 104, 131); font-size: 24px; line-height: 28px;">DENN SKAL SLETTES</span></p>
    </div><div class="art-layout-cell layout-item-0" style="width: 50%" >
        <p>DENNE SKAL SLETTES</p>
    </div>
    </div>
</div>
<div class="art-content-layout">
    <div class="art-content-layout-row">
    <div class="art-layout-cell layout-item-0" style="width: 100%" >
        <p><span style="color: rgb(78, 104, 131); font-size: 24px; line-height: 28px;">
		<div>1"Finnes det liv p¿ andre planeter ?</div><div>2"Er det morro og vere Norsk i Danmark ?</div><div>3"Er det skudd¿r hvert ¿r ?</div>		</span><br></p>
    </div>
    </div>
</div>
</div>


</article></div>
                    </div>
                </div>
            </div><footer class="art-footer">
<p><a href="#">Link1</a> | <a href="#">Link2</a> | <a href="#">Link3</a></p>
<p>Copyright © 2013. All Rights Reserved.</p>
</footer>

    </div>
    <p class="art-page-footer">
        <span id="art-footnote-links"><a href="http://www.artisteer.com/" target="_blank">Web Template</a> created with Artisteer by <a href="http://www.softkey.no" target="_blank">Tor Erik Berg</a>.</span>
    </p>
</div>


</body></html>

Open in new window

0
 
Ray PaseurCommented:
What line numbers are we looking for?
0
 
team2005Author Commented:
70
0
 
Ray PaseurCommented:
The DIV tag is a block element, so its styling is probably overriding anything in the SPAN wrapper.  Also, I tried to validate this with the W3C and got this message:

Sorry, I am unable to validate this document because on line 70 it contained one or more bytes that I cannot interpret as utf-8 (in other words, the bytes found are not valid values in the specified Character Encoding). Please check both the content of the file and the character encoding indication.
The error was: utf8 "\xBF" does not map to Unicode
0
 
team2005Author Commented:
thanks
0

Featured Post

Take Control of Web Hosting For Your Clients

As a web developer or IT admin, successfully managing multiple client accounts can be challenging. In this webinar we will look at the tools provided by Media Temple and Plesk to make managing your clients’ hosting easier.

  • 6
  • 6
Tackle projects and never again get stuck behind a technical roadblock.
Join Now