Solved

This html/php code dosent work correct

Posted on 2013-05-16
13
408 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 108

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 108

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
 
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 108

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
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
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 108

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 108

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 108

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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
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 is …
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…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

744 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now