-2

i can't find the error. Someone could help me?

The parser say this:

Parse error: syntax error, unexpected T_STRING, expecting ',' or ';'

Here's the code:

     if(1 != $pages)
         {
             echo "<div class="pagination"><span>Pagina ".$paged." di ".$pages."</span>";
         }
Marco Gomiero
  • 41
  • 2
  • 7
  • You have to escape your double-quotes when defining your DIV-class., like this: `class=\"pagination\"`. – Qirel Aug 25 '15 at 11:42
  • The problem is that you are using double quotes inside the string you wish to echo, which closes the string. Your program sees `echo "
    – Aaron D Aug 25 '15 at 11:42

2 Answers2

1

Change to

echo "<div class=\"pagination\"><span>Pagina ".$paged." di ".$pages."</span>";
Harshit
  • 5,147
  • 9
  • 46
  • 93
1

You're echoing all stuff in double quotes ", so as you doing for class as well, in actual, this is happening

echo "<div class="pagination"><span>Pagina ".$paged." di ".$pages."</span>"

so if you pay attention, what is happening here is: echo "stuff class = "class" other stuff here!"

so you're putting double quotes(DQ) " inside DQ. to make this work, wither you'll have to escape them properly(by putting back slash \ in front of each inner DQ like this

echo "<div class=\"pagination\"><span>Pagina ".$paged." di ".$pages."</span>"

OR simply using single quote ' for class = 'pagination' instead of DQs

if(1 != $pages)
     {
         echo "<div class='pagination'><span>Pagina ".$paged." di ".$pages."</span>";
     }
Mubin
  • 4,325
  • 5
  • 33
  • 55