Solved

This html/php code dosent work correct

Posted on 2013-05-16
13
415 Views
Last Modified: 2013-05-22
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
Comment
Question by:team2005
  • 6
  • 6
13 Comments
 
LVL 109

Assisted Solution

by:Ray Paseur
Ray Paseur earned 500 total points
ID: 39171203
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
 
LVL 2

Author Comment

by:team2005
ID: 39171255
Hi!

How about the styling issue ?
0
 
LVL 109

Expert Comment

by:Ray Paseur
ID: 39171374
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
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
LVL 15

Expert Comment

by:Jagadishwor Dulal
ID: 39171536
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
 
LVL 2

Author Comment

by:team2005
ID: 39183471
Hi!

Can't use PHP code witout <?php tag ?
0
 
LVL 109

Expert Comment

by:Ray Paseur
ID: 39184208
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
 
LVL 2

Author Comment

by:team2005
ID: 39184254
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
 
LVL 109

Expert Comment

by:Ray Paseur
ID: 39184328
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
 
LVL 2

Author Comment

by:team2005
ID: 39184346
<!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
 
LVL 109

Expert Comment

by:Ray Paseur
ID: 39184414
What line numbers are we looking for?
0
 
LVL 2

Author Comment

by:team2005
ID: 39184458
70
0
 
LVL 109

Accepted Solution

by:
Ray Paseur earned 500 total points
ID: 39184657
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
 
LVL 2

Author Closing Comment

by:team2005
ID: 39186776
thanks
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question