Link to home
Create AccountLog in
Avatar of team2005
team2005

asked on

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 ?
SOLUTION
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of team2005
team2005

ASKER

Hi!

How about the styling issue ?
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.
Avatar of Jagadishwor Dulal
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

Hi!

Can't use PHP code witout <?php tag ?
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/
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>";
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.
<!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

What line numbers are we looking for?
70
ASKER CERTIFIED SOLUTION
Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
thanks