Page 1 of 1

Php error unexpected echo

Posted: 16 Apr 2016, 08:09
by mluci12
Hello admin
I have next php code

Code: Select all

  foreach($datas as $row) {
        $html ='';
if($row['complementar'] =='wait') $html .='<span class="label label-warning">wait</span>';
else if($row['status'] =='activ') $html .='<span class="label label-success">Approved</span>';

      echo '  <tr>
                      <td>'.$row['ID'].'</td>
                      <td>'.$row['servicii2'].'</td>
                      <td>'.echo $html;.'</td>
                      <td>'.$row['buget'].'</td>
                      
                    </tr>
                    '; 
But i get a error on echo line

Code: Select all

Parse error: syntax error, unexpected 'echo' (T_ECHO)

Php error unexpected echo

Posted: 16 Apr 2016, 16:05
by Admin
Hi
There is a second "echo" mixed in tne echo content.
Try:

Code: Select all

echo '<tr>
 <td>'.$row['ID'].'</td>
 <td>'.$row['servicii2'].'</td>
 <td>'. $html .'</td>
 <td>'.$row['buget'].'</td>
 </tr>';