适用于Mac OS XAMPP但不适用于Windows XAMPP

时间:2016-12-05 18:40:32

标签: php mysql xampp

所以我的问题是代码(我在下面添加它)适用于MAC OS X XAMPP,但不能在Windows XAMPP上运行。 Actualy,大多数代码都有效。但它不会回显从数据库中获取的变量:$rows['pavadinimas'], $rows['metai']等。看起来确实如此,但它们并不可见。导致输入表格的内容: Example of the table

在数据库中写入所有数据。 database example

所以有些东西在那里,但是看不见。它在MAC OS X XAMPP上是可见的,但不在WINDOWS上。而且只有从数据库中获取的变量。

代码:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Žurnalai</title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<link href="http://fonts.googleapis.com/css?family=Karla:400,700" rel="stylesheet" />
<link href="default.css" rel="stylesheet" type="text/css" media="all" />
<link href="fonts.css" rel="stylesheet" type="text/css" media="all" />
<!--[if IE 6]>
<link href="default_ie6.css" rel="stylesheet" type="text/css" />
<![endif]-->
</head>
<body>
<div id="wrapper">
    <div id="header-wrapper">
        <div id="header" class="container">
            <div id="logo">
                <h1><a href="#">Some text</a></h1>
                <p>Some text</p>
            </div>
            <div id="banner"> <a href="#" class="image"><img src="images/pic01.jpg" alt="" /></a> </div>
        </div>
    </div>
    <div id="page" class="container">
        <div id="content">
            <div class="title">
                <h2>Žurnalai</h2>
                <span class="byline">Some text</span> </div>

    <?php
$host="localhost";
$username="root";
$password="";
$db_name="zurnalas";
$tbl_name="zurnalas";

// Connect to server and select databse.
$mysqli = new mysqli("$host", "$username", "$password", "zurnalas");

$sql="SELECT * FROM $tbl_name";
$result=$mysqli->query($sql);
?>
<form name="form1" method="post" action="">
<table width="500" border="0" cellspacing="1" cellpadding="0">
<tr>
<td><form name="form1" method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>">
<table width="600" border="0" cellpadding="3" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td bgcolor="#FFFFFF">&nbsp;</td>
<td colspan="4" bgcolor="#FFFFFF"><strong>Žurnalų sÄ…raÅas</strong> </td>
</tr>
<tr>
<td align="center" bgcolor="#FFFFFF"><strong>Pavadinimas</strong></td>
<td align="center" bgcolor="#FFFFFF"><strong>Per metus iÅleidžiama</strong></td>
<td align="center" bgcolor="#FFFFFF"><strong>Leidykla</strong></td>
<td align="center" bgcolor="#FFFFFF"><strong>Leidimo Metai</strong></td>
<td align="center" bgcolor="#FFFFFF"><strong>Kaina</strong></td>
</tr>

<?php
while($rows=$result->fetch_assoc()){
?>

<tr>
<td align="center" bgcolor="#FFFFFF"><? echo $rows['pavadinimas']; ?></td>
<td align="center" bgcolor="#FFFFFF"><? echo $rows['kiekis'] . " vnt."; ?></td>
<td align="center" bgcolor="#FFFFFF"><? echo $rows['leidykla']; ?></td>
<td align="center" bgcolor="#FFFFFF"><? echo $rows['metai'] . " metai"; ?></td>
<td align="center" bgcolor="#FFFFFF"><? echo $rows['kaina'] . " eurų"; ?></td>
</tr>

<?php
}
?>
    </table>
    </form>
    </table>
    </div>
    </div>
    </div>
    </div>
    </body>
    </html>

0 个答案:

没有答案
相关问题