转到上一个单词的链接

I have this:

    if(mysql_num_rows($raw_results) > 0){ // if one or more rows are returned do following

        while($results = mysql_fetch_array($raw_results)){
        // $results = mysql_fetch_array($raw_results) puts data from database into array, while it's valid it does the loop
        if
            ($results['cod'] == $query){             
            header('Location: /shop-'$results['cod']'.html'); 
                }
            // posts results gotten from database(title and text) you can also show id ($results['id'])
        }

    }

And i wanna go to => webiste.xx/shop-PREVIOUSLY WORD INTRODUCED ($query).html. How can i do this?

You have a syntax error in your code. your header string is not correctly concatenated.

Change

header('Location: /shop-'$results['cod']'.html');

To

header('Location: /shop-' . $results['cod'] . '.html');

and after redirect. don't forget to die or exit your script

header('Location: /shop-' . $results['cod'] . '.html');
die;