douyu9159 2017-04-09 06:18
浏览 40

PHP文件下载而不是运行

I have seen the other similar questions but my httpd_config is read only and making a new copy and adding in the suggested lines doesn't work. i even put the file in the same directory as my .html file and .php file. Here is my code for the .html the form is in bold:

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

Here is my PHP file which doesn't run at all:

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

Any help is greatly appreciated!

</div>
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 python的qt5界面
    • ¥15 无线电能传输系统MATLAB仿真问题
    • ¥50 如何用脚本实现输入法的热键设置
    • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
    • ¥30 深度学习,前后端连接
    • ¥15 孟德尔随机化结果不一致
    • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
    • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
    • ¥15 谁有desed数据集呀
    • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100