Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
我用php创建了RSS提要,该提要也会显示在页面上,但他们现在被评论爱情板弄得疲惫不堪,我如何修复它?_Php_Xml_Rss_Comments_Feed - Fatal编程技术网

我用php创建了RSS提要,该提要也会显示在页面上,但他们现在被评论爱情板弄得疲惫不堪,我如何修复它?

我用php创建了RSS提要,该提要也会显示在页面上,但他们现在被评论爱情板弄得疲惫不堪,我如何修复它?,php,xml,rss,comments,feed,Php,Xml,Rss,Comments,Feed,在这段代码中,当我评论$description=$row['description']时会显示提要此部分,但不是通过评论获取,请帮助 这是我的密码,请帮忙 <?php $host = 'localhost'; $user = 'root'; $password = 'Qwaszx12'; $dbname = 'ravisah'; $con=mysqli_connect($host,$user,$password

在这段代码中,当我评论
$description=$row['description']时会显示提要此部分,但不是通过评论获取,请帮助
这是我的密码,请帮忙

<?php
        $host = 'localhost';
        $user = 'root';
        $password = 'Qwaszx12';
        $dbname = 'ravisah';
        $con=mysqli_connect($host,$user,$password,$dbname);
    if (mysqli_connect_error()) {
        echo "Failed to connect to MySQL: " . mysqli_connect_error();
    }

    $sql = "SELECT * FROM posts ORDER BY id DESC";
    $query = mysqli_query($con, $sql) or die('error');

    @header("Content-type: text/rss+xml");

    echo "<?xml version='1.0' encoding='UTF-8'?>
            <rss version='2.0'>
            <channel>
            <title>Freelance Web Designer in Delhi, India - Ravi Sah</title>
            <link>http://www.ravisah.in</link>
            <description>I am Delhi based responsive website designer and website developer. I am passionate about designing and worked with various clients</description>";

    while($row = mysqli_fetch_array($query, MYSQLI_ASSOC)) {
        $title=$row['title'];
        $link=$row['slug_url'];
        $description=$row['description'];

        echo "<item>
                <title>$title</title>
                <link>http://ravisah.in/blog/$link</link>
                <description>$description</description>
             </item>";
    }
    echo "</channel>";
    echo "</rss>";

    ?>

RSS提要,用于以XML格式简单发布任何数据。在上述代码中,未提及“爱情板”。您已经使用like运算符从数据库中获取查询

您必须更改数据库查询,例如

$sql = "SELECT * FROM posts where description like '%love boards%' ORDER BY id DESC";
$query = mysqli_query($con, $sql) or die('error');