简体   繁体   English

Xampp不会更新我的PHP代码

[英]Xampp doesnt update my php-code

I recently started coding in php again. 我最近再次开始使用php进行编码。 Well, and my problem is simple. 好吧,我的问题很简单。 Xampp or whatsoever is not updating my file, but if I construct annother error on purpose. Xampp或其他任何东西都不会更新我的文件,但是如果我故意构造另一个错误。

Code: 码:

public function getPosts($from, $to){
        $query = "SELECT DISTINCT * FROM entries LIMIT ". $from .",". $to;
        $result = mysql_query($query);

        $posts = array();
        $i = 0;
        while($row = mysql_fetch_array($result)){
            $p = "f";
            $i++;
        }
        mysql_free_result($result);
        return $posts;
    }

Parse error: syntax error, unexpected 'Post' (T_STRING), expecting variable (T_VARIABLE) in C:\\xampp\\htdocs\\websitews\\webapi\\Post.php on line 13 解析错误:语法错误,意外的'Post'(T_STRING),第13行的C:\\ xampp \\ htdocs \\ websitews \\ webapi \\ Post.php中的预期变量(T_VARIABLE)

I was creating a new object of type Post, but there is nothing of such left - at all! 我正在创建一个Post类型的新对象,但是没有剩下的了-根本没有! $p = "f"; was just a test if it would update after I deleted $p = new Post(); 只是测试是否可以在删除$p = new Post();之后更新$p = new Post();

Could you tell me what I am doing wrong? 你能告诉我我在做什么错吗? ^.^ Thanks! ^。^谢谢! I'm freaking out on this! 我很惊讶!

You never ended your SQL query 您从未结束过SQL查询

 $query = "SELECT DISTINCT * FROM entries LIMIT ". $from .",". $to;

should be 应该

 $query = "SELECT DISTINCT * FROM entries LIMIT '". $from ."','". $to"'";

See what that does for you 看看有什么用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM