PHP文件下载而不是运行

时间:2017-04-09 06:18:14

标签: php html mysql

我已经看到了其他类似的问题,但我的httpd_config是只读的,并且制作新副本并添加建议的行不起作用。我甚至把文件放在与我的.html文件和.php文件相同的目录中。 这是我的.html代码,表格是粗体:

<!DOCTYPE html>
<html>
<head>
<style>
div.container {
    width: 100%;
    border: 1px solid gray;
}

header, footer {
    padding: 1em;
    color: white;
    background-color: black;
    clear: left;
    text-align: center;
}

nav {
    float: left;
    max-width: 160px;
    margin: 0;
    padding: 1em;
}

nav ul {
    list-style-type: none;
    padding: 0;
}
   
nav ul a {
    text-decoration: none;
}

article {
    margin-left: 170px;
    border-left: 1px solid gray;
    padding: 1em;
    overflow: hidden;
}
</style>
</head>
<body>




<div class="container">

<header>
   <h1>Online Food Orderer</h1>
</header>
  
<nav>
  <ul>
    <li><a href="http://www2.macs.hw.ac.uk/~ra46/Home.html">Home</a></li>
    <li><a href="http://www2.macs.hw.ac.uk/~ra46/NewOrder.html">New Order</a></li>
    <li><a href="http://www2.macs.hw.ac.uk/~ra46/PreviousOrders.html">Previous Orders</a></li>
    <li><a href="http://www2.macs.hw.ac.uk/~ra46/Account.html">Account</a></li>
	<li><a href="http://www2.macs.hw.ac.uk/~ra46/AddRestaurant.html">Add Restaurant</a></li>
  </ul>
</nav>

<article>
  <h1>Previous Orders</h1>
<body>
*<form action="php.php" method = "post">
<table>
<tr>
<td> Customer Number </td>
<td> <input type = "text" name="customer_number"
		size="5" /> </td>
</tr>
</table>
<p> <input type ="submit" value="submit" />  </p>
   </form>*
</body>


</article>

   
<footer>Assignment 2</footer>

</div>

</body>
</html>

这是我的PHP文件根本不运行:

<?php
$db = mysql_connect(string server= ini_get("mysql.default_host"),
string username= =ini_get("mysql.default_user"),
string password= =ini_get("mysql.default_password"))
or die('Error connecting to MySQL server');
sql.safe_mode boolean


?>
<HTML>
	<head>
</head>
<body>




<h1>PHP connect to MySQL</h1>

<?php
$query = "SELECT * FROM Customer";
mysqli_query($db, $query) or die ('Error querying database.');

$result = mysqli_query($db,$query );
$row = mysqli_fetch_array($result );

while ($row = mysql_fetch_array($result)) {
	echo $row['firstName'].' '.$row['lastName'].': '.$row['email'] .'<br />';
}
mysqli_close($db);
?>


</body>
</HTML>

非常感谢任何帮助!

0 个答案:

没有答案