Retrieve data SQL syntax error

Hello,
Can you please correct the syntax error in this code

 if(mysqli_num_rows($  sql) > 0)     {         while($  row = mysqli_fetch_array($  sql))         {             $  result .='             <tr>             <td>'.$  row["title"].'</td>             <td>'.$  row["name"].'</td>             if($  row["type"]==2)             { echo "<td>type2</td>";}               else if($  row["type"]==1)              {echo"<td>type1</td>";}              else if($  row["type"]==3)...
Code (markup):

Retrieve data SQL syntax error