Solved

This html/php code dosent work correct

Posted on 2013-05-16
13
417 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 6
13 Comments
 
LVL 110

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 110

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
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

 
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 110

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 110

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 110

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 110

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
This article discusses four methods for overlaying images in a container on a web page
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

738 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