Php error unexpected echo

Discuss coding issues, and scripts related to PHP and MySQL.
mluci12
Posts:39

Php error unexpected echo

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)

Admin Posts:805
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>';