我其中一页出错了


Error on one of my pages

我把我的第一个网站上传到网上。

一切都是工作后一些调整这里和那里除了一个页面;在我得到错误信息This webpage is not available ERR_TIMED_OUT之前,这个页面只是永远加载。

当我使用XAMPP在本地主机上测试时,我没有得到这个问题。有什么我应该知道的共同原因吗?

可能值得一提的是,这是网站上唯一使用urlencode来确定从MySQL显示哪些记录的页面。其他页面也使用mysql,但没有urlencode。

我会放一个链接到网站,这样你就可以看到,但我还没有准备好让全世界看到它,如果它仍然有问题。(我希望你能理解)

任何帮助将非常感激!

这是该页的代码

<?php
    session_start();
    $somethingID = $_GET['anIDhere'];
    $username = "x";
    $password = "x";
    $hostname = "x";
    $db_handle = mysql_connect($hostname, $username, $password) or die ("Could not connect to database");
    $selected= mysql_select_db("aDatabaseHere", $db_handle);
    $query = mysql_query("SELECT * FROM something WHERE id ='$somethingID'") or die ("oops");
    //assigns some details about the records found above to some variables
   //
   //
     }                
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><!-- <!doctype html> -->
<html xmlns="http://www.w3.org/1999/xhtml">
   <head>
      <title>x</title>
   <link href="../style/style.css" rel="stylesheet" type="text/css"/>
   <link rel="shortcut icon" href="x"/>
   </head>
   <body>
      <div id="header">
         <div id="headerWrap">
            <div id="headerWrapLogo">
               <a href="../index.php"><img id="logo" src="x"/></a>
            </div>
            <div id="headerWrapRest">
              <div id="headerWrapRestTop" >
              </div>
              <div id="headerWrapRestBottom">
                   <div>
                    <a href="somthing">x</a>
                    <a href="somthing">x</a>
                    <a href="somthing">x</a>
                    <a href="somthing">x</a>
                         <div id="searchdiv">
                         <a form which does something and is not the problem>
                    </div>   
                 </div>
              </div>
            </div>
         </div>
      </div>
      <div id="middle">
            <div id="codehere">
               <?php
                  echo $somestuff;
                  echo $otherstuff;
               ?>   
         </div>
         some open source javascript here
   </body>
</html>

我也知道我不应该使用这些msql_方法,我很快就会改变,在有人对我去。

引用我昨晚又看了一遍的《布莱恩的一生》电影中的一些台词:

Prophet III: ...through Hebediah, his servants. There shall
in that time be rumours, of things going astray. Ehm...and
there
shall be a great confusion as to where things really are.
And nobody will really know where lieth those little things
wi...with a
sort of rackey work base, that has an attachment. At this
time, a friend shall lose his friend's hammer, and the young
shall not
know where lieth the things possessed by their fathers, that
their fathers put there only just the night before, 'bout
eight
o'clock.

所以使用它,我认为你有一些东西与其他东西有附件,它创造了某些东西偏离

尽管德鲁·皮尔斯很有趣,但你需要:

i)检查你的DNS -你的网站(s)FTP主机(你把文件的地方)实际上是可用的浏览器(http://)在网络上达到?

这可能需要长达24小时。

ii)检查你没有任何问题或错误与你的。htaccess文件,如果使用,如果你有一个,删除它,看看网站是否正确加载。

iii)尝试按CTRL - F5从服务器强制刷新,而不是从任何中间缓存。

另外

iV)如果你网站上的其他页面工作,然后简单地注释掉PHP代码和/或mySQL代码并重新加载,看看页面是否工作。如果是这样,那么错误肯定在PHP/MySQL。

V)使用(V),读取堆栈溢出并插入适当的错误日志到您的页面,然后读取错误日志报告的内容。

vi) 强烈建议您不要使用MySQL,而是学习改进的MySQLi,因为前者已被弃用,不再维护,并且充满了安全漏洞和漏洞。mysql是您应该从这一点出发的方式(PDO也是如此)。

vii)使用像http://redbot.org/这样的网站来检查标题信息。看看它是否返回一个代码200或者它返回的是什么代码?

viii)为清楚起见-$query = mysql_query("SELECT * FROM something WHERE id ='$somethingID'")或die ("oops");

应该被封装在IF语句中,这样如果$somethingID的值为零或非数字,MySQL就不会触发。:

if ($somethingID > 0 && is_numeric($somethingId)){ 
    $query = mysql_query("SELECT * FROM something WHERE id ='$somethingID'") or die ("oops");
}

这只是为了整洁,否则SQL会使用空值进行搜索,这可能会导致问题。