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!

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."'");

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.

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

It's not only the missing special characters, depending on the used collation the comparison can become case-sensitive:

The easy solution is to add an url slug column to the table, so you query directly the slug. Which should be UNIQUE:

ALTER TABLE `wp_feed` ADD `url_slug` VARCHAR(255) NOT NULL UNIQUE AFTER `feedTitulo`;
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.