php - 有谁知道什么可能导致这个 fatal error ?

标签 php mysql mamp

我在 MAMP 上的 PHP 错误不起作用,我已经打开它们,但仍然没有任何结果。
那里有一个错误,我看了又看,但找不到任何东西。
它没有返回任何内容,所以我猜测这是一个 fatal error 。

<?php include("scripts/config.php");
include("scripts/facebook.php");

"INSERT INTO likes (like, pop, date)
VALUES ('$_POST[like_box]','0', now())";       
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta content="en-gb" http-equiv="Content-Language" />
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>theupdate</title>
<link rel="stylesheet" type="text/css" href="main.css" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js" type="text/javascript"></script>
<script type="text/javascript">
$(function() {
//More Button
$('.more').live("click",function() 
{
  var ID = $(this).attr("id");
  if(ID)
  {
    $("#more"+ID).html('<img src="moreajax.gif" />');

    $.ajax({
      type: "POST",
      url: "new/ajax_more.php",
      data: "lastmsg="+ ID, 
      cache: false,
      success: function(html){
      $("ol#updates").append(html);
      $("#more"+ID).remove();
    }
  });
}else{
  $(".morebox").html('no more posts to display'); 
}
return false;

});
});

</script>

<style>a { text-decoration:none; color:#0066CC}
a:hover { text-decoration:underline; color:#0066cc }
*
{
    margin: 0px;
    padding: 0px;
}
ol.timeline
    { list-style:none}ol.timeline li{ position:relative;border-bottom:1px #dedede dashed; padding:8px; }ol.timeline li:first-child{}
    .sssss {
    color: #ededed;
    height:1px;
}

    .morebox
    {
    font-weight:bold;
    color:#333333;
    text-align:center;
    border:solid 1px #333333;
    padding:8px;
    margin-top:8px;
    margin-bottom:8px;
    }
    .morebox a{ color:#333333; text-decoration:none}
    .morebox a:hover{ color:#333333; text-decoration:none}
    #container{margin-left:60px; width:580px }

.style11113 {
    font-family: Arial, Helvetica, sans-serif;
}

.style11114 {
    text-align: left;
}
.style11115 {
    font-family: Arial, Helvetica, sans-serif;
    font-size: medium;
}

.style11117 {
    font-family: "Trebuchet MS", "Lucida Sans Unicode", "Lucida Grande", "Lucida Sans", Arial, sans-serif;
    font-size: medium;
}

.style11118 {
    text-align: right;
}
.style11119 {
    color: #ededed;
    text-decoration: none;
    font-family: "lucida grande", tahoma, verdana, arial, sans-serif;
    margin-top: 13px;
}
.style11120 {
    margin-top: 0px;
}

.style11121 {
    margin-bottom: 0px;
}

.style11122 {
    font-family: "Trebuchet MS", "Lucida Sans Unicode", "Lucida Grande", "Lucida Sans", Arial, sans-serif;
    font-size: small;
    text-align: left;
    margin-top: 4px;
}

.style11123 {
    font-size: x-small;
}

</style>

</head>
<body>
<div align="center">
    <div align="left" style="height: 36px; width: 954px; background-color:#7B0004;" >
        <table style="width: 100%; height: 32px" class="style4">
            <tr>
                <td style="height: 30px; width: 144px;">&nbsp;&nbsp;&nbsp;<span class="style11113"><strong>facebook quotes</strong></span></td>
                <td style="height: 30px; width: 594px;"><a href="new.php" class="style4">new likes</a> &nbsp;<a href="popular.php" class="style4">popular 
                likes</a></td>
                <td style="height: 30px"><a href="http://www.facebook.com" class="style4">back 
                to facebook.com</a></td>
            </tr>
        </table>
    </div>
    <div style="border-left: 1px solid #b3b3b3; border-right: 1px solid #b3b3b3; border-top: 0px; border-bottom: 1px  solid #b3b3b3; width: 859px; height: 545px; ">
        <div style="height: 564px; width: 952px;">
            <div style="width: 297px; float:right; height: 538px;">
                <?php
$sql=mysql_query("select * from likes ORDER BY date DESC LIMIT 9");
while($row=mysql_fetch_array($sql))
{

$like_count = $facebook->api(array(  
    'method' => 'fql.query',  
    'query' => 'select like_count from link_stat where url = "http://www.quotefacebook.com/like.php?id=$row['id']"'
));

mysql_query("UPDATE likes WHERE id=$row['id'] SET pop=$like_count")

?>


<?php } ?>
</div>



            <div style="width: 654px; float:left; height: 540px;" class="style11114">
                <div class="style11114">
                    <span class="style11115">&nbsp;</span><span class="style11117">create a facebook like..</span><br /></div>
                <form method="post" action="self">
                    <div class="style11118">


                        <table class="style11120" style="width: 100%; height: 59px">
                            <tr>
                                <td style="width: 648px">
                                <textarea name="TextArea1" style="width: 524px; height: 52px"></textarea>&nbsp;</td>
                            </tr>
                            <tr>
                                <td class="style11118" style="width: 648px">
                                <input name="Submit1" style="width: 78px" type="submit" value="submit">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
                                &nbsp;</td>
                            </tr>
                        </table>
                                                <hr class="sssss " noshade="noshade" style="height: 1px" />

                    </div>
                </form>

            <?php 
$sql=mysql_query("select * from likes ORDER BY date DESC LIMIT 9");
while($row=mysql_fetch_array($sql))
{
$like_count = $facebook->api(array(  
    'method' => 'fql.query',  
    'query' => 'select like_count from link_stat where url = "http://www.quotefacebook.com/like.php?id=$row['id']"'
));
*
mysql_query("UPDATE likes WHERE id=$row['id'] SET pop= " . $like_count . "")

?>


                <table style="width: 100%; height: 7px;" class="style11119">
                    <tr>
                        <td style="width: 68px; height: 23px;" class="style11111 " valign="top">
                        <div id="fb-root">
                        </div>
                        <script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script>
                        <fb:like href="http://www.quotefacebook.com/like.php?id=<?php print $row['id']; ?>" send="false" layout="button_count" width="0" show_faces="false" font="">
                        </fb:like>
                        </td>
                        <td style="height: 23px" class="style11112"><?php print $row['like']; ?>
                        </td>
                    </tr>
                    <tr>
                        <td style="height: 23px;" class="style1" colspan="2" valign="top">
                        <hr class="sssss " noshade="noshade" style="height: 1px" />
                        </td>
                    </tr>
                </table>
<?php } ?>
                <div id="more<?php echo $msg_id; ?>" class="morebox">
                    <a href="#" class="more" id="<?php echo $msg_id; ?>" style="font-family:Arial, 'Helvetica', sans-serif;
">more</a> </div>
</div>



            <div class="style11121">

<div style="width: 939px; height: 16px;" class="style11122">
    <span class="style11123">this website is not associated with facebook in anyway, 
    at all.. seriously.&nbsp; </span>
    <span class="style11123" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: arial, sans-serif; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">
    <span class="Apple-style-span" style="line-height: 15px; ">© 2011</span></span></div>

            </div>



            </div>
    </div>
</div>

</div>

</body>

</html>

最佳答案

第二个 while 循环中的代码中有一个随机星号字符。此行的 PHP 语句中还缺少两个分号:

mysql_query("UPDATE likes WHERE id=$row['id'] SET pop=$like_count")

还有这一行

mysql_query("UPDATE likes WHERE id=$row['id'] SET pop= " . $like_count . "")

如果这不能解决您的错误,那么在包含之后,您将:

"INSERT INTO likes (like, pop, date)
VALUES
('$_POST[like_box]','0', now())";

这是一个未分配任何内容的字符串。它可能会导致您的错误。把它拿出来试试。如果这不是您问题的根源,那么看看您的问题所在:

"UPDATE likes WHERE id=$row['id'] SET pop=$like_count"

我会在数组变量和字符串的其余部分之间添加一个点,这样它就会变成:

"UPDATE likes WHERE id=".$row['id']." SET pop=$like_count"

我会在您执行此操作的多个位置进行此更新。

此外,第一个 while 循环之后的额外 PHP 标签实际上是不必要的。您可以正常关闭 while 循环。所以代替:

?>


<?php } ?>

你可以尝试:

} ?>

关于php - 有谁知道什么可能导致这个 fatal error ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5925492/

相关文章:

php - 使用 PHP 识别特定值范围内的行数

php - 如何从 JS 数组通过 JSON 获取 PHP 数组? (我至少在那里的一半)

php - 使用php中的文件输入在mysql中存储共享路径

PHP设置值时的查询问题?

php - wordpress 无法连接到数据库

php - 使用 PDO 返回非关联数组

mysql - 连接表本身以复制匹配相同产品的列

php - 大于语句中包含不需要的字符

mysql - 将 MySQL root 密码重置为 "default"- MAMP

php - 为什么我的表单没有发布到数据透视表?