所以我有一個MySQL數據庫,我已經把它連接到一些PHP和HTML文件。我的php文件位於localhost文件夾中。當我運行我的測試html文件,這也是我的localhost文件夾,它沒有問題找到該文件,但是當我有一個名爲「SriMeru」我的localhost文件夾中的子文件夾,其中我有我的實際html文件格式和其他東西與最終的PHP文件,該HTML文件無法找到該PHP文件。下面是在HTML文件中的一些代碼:本地主機上的奇怪的404錯誤
<div id="mmargin" style="background-color:#F1ECDF;height:810px;width:600px;float:left;">
<p id = "myDiv">no</p>
<script>
function loadPHPDoc(str){
var xmlhttp;
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("myDiv").innerHTML=xmlhttp.responseText;
}
else{
document.getElementById("myDiv").innerHTML="failure";
}
}
xmlhttp.open("POST","srimeru/forumSubmit.php",true);
xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
var sender = "q=" + str;
xmlhttp.send(sender);
}
</script>
<p>
Message <input type= "text" id="messbox">
<button type= "button" onclick="loadPHPDoc(document.getElementById('messbox').value)">input</button>
</p>
</div>
,這裏是我的PHP文件中的代碼:
<?php
$q = $_POST["q"];
$messData = mysqli_connect("localhost", "root", "chendu", "SriMeru");
if (mysqli_connect_errno()){
echo "Failed to connect to Server";
}
$sql = "INSERT INTO messages VALUES ('".$q."')";
mysqli_query($messData, $sql);
echo "<p>success</p>";
mysqli_close($messData);
?>
在HTML文件中的其它地方,我有涉及帳篷和定時器一些奇怪的格式,我知道,如果不這可能會搞砸了。
SriMeru = srimeru – 2014-08-28 00:55:26
邊注:一般認爲使用'marquee'任何人都不應取出回射。 – 2014-08-28 00:58:11
我明白了,謝謝。打擾大門,這是我第一次製作網站。 – 2014-08-28 01:15:22