0

Hi,

I'm using .htaccess clean url and this is my url, when i want to see all the information of an article:
http://localhost/projectoname/news/something-happened-on-todays-news

And i have this code so i can get the information of the article:

<?php
    //this output is -> something happened on tadays news
    $item = mysqli_real_escape_string($dbConnect, str_replace('-', ' ', $_GET['pagination']));

    $feedOne = '';
    $selectFeed = $dbConnect->query("SELECT *
                                     FROM `wp_feed`
                                     WHERE `feedTitulo` LIKE '".$item."'
                                     AND `feedTipo`='".$_GET['page']."'");

    $rowFeed = $selectFeed->fetch_assoc();

    if($selectFeed->num_rows > 0)
    {
        $id=$rowFeed['ID'];
        $tipo=$rowFeed['feedTipo'];
        $titulo=$rowFeed['feedTitulo'];
        $texto=$rowFeed['feedTexto'];
        $imagem=$rowFeed['feedImagem'];
        $data=$rowFeed['feedData'];
        $autor=$rowFeed['feedAutor'];
        $tags=$rowFeed['feedTags'];

        $feedOne .= '<article class="feedOne">';
            $feedOne .= '<div class="imageSquare">';
                $feedOne .= '<img src="'.$imagem.'" alt="'.$titulo.'" title="'.$titulo.'" />';
            $feedOne .= '</div>';

            $feedOne .= '<div class="textSquare">';
                $feedOne .= '<h1>'.$titulo.'</h1>';

                $feedOne .= '<div class="meta">';
                    $feedOne .= '<span class="datetime">'.$data.' </span>';
                    $feedOne .= '<span class="author">by <a href="#">'.$autor.'</a></span>';
                $feedOne .= '</div>';

                $feedOne .= '<div class="textExcerpt">';
                    $feedOne .= '<p>'.$texto.'</p>';
                $feedOne .= '</div>';
            $feedOne .= '</div>';
        $feedOne .= '</article>';

        echo $feedOne;
    }
    else
    {
        echo 'Feed Not Found.';
    }
?>

But it gives me always 'Feed Not Found'. Is there any alternative so i can get the article's information?

Thank you!

Edited by pritaeas: Moved.

2
Contributors
5
Replies
48
Views
2 Years
Discussion Span
Last Post by cereal
0

I already tried that wildcard, even this way:

LIKE '%".$item."%'

And it keeps "Feed Not Found".

I changed the code like you said:

    $item = mysqli_real_escape_string($dbConnect, str_replace('-', ' ', $_GET['pagination']));
    $tipo = mysqli_real_escape_string($dbConnect, $_GET['page']);

    $feedOne = '';
    $selectFeed = $dbConnect->query("SELECT *
                                     FROM `wp_feed`
                                     WHERE `feedTitulo` LIKE '".$item."%'
                                     AND `feedTipo`='".$tipo."'");
0

Ok, if you run the query in a MySQL client as command line or PHPMyAdmin do you get results?

If the answer is yes, then are you sure that $_GET['pagination'] is correctly populated by your .htaccess rewrite rules?

To test it just try:

print_r($_GET);

to see the contents of this array.

0

It doesn't get any results.

I've noticed other thing comparing the url name and the title of the article.

In this way it doesn't found (if the title has other characters -> ': & - + []')

[URL] gates-of-hell-new-single-will-reveal-the-new-frontman

[Title] GATES OF HELL: new single will reveal the new frontman

But like this it works:

[URL] interview-with-equaleft

[Title] Interview with Equaleft

Edited by paulo.guedes1992

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.