0

I have tried to echo the table fields one by one. But I can't echo the image field. My code is:

if ($data->Prophylaxis_Indicated == 1) {
    echo "<td><span title='true_logo'> <img src='url('images/1-icon.png')' height='20' width='20'></span></td>";
} else {
    echo "<td> <span title='true_logo'><img src='url('images/0-icon.png')'height='20' width='20'></span></td>";
}

3 Answers 3

1

this works for me

if(($data->Prophylaxis_Indicated)==1){
                echo " 
                <td>
                <span title='true_logo'>

                <img src='/../images/1-icon.png' height='20' width='20'> 
                </span>
                </td>";

              }
              else{

               echo "<td> <span title='true_logo'>
               <img src='/../images/0-icon.png' height='20' width='20'> 


               </span></td>";
             }
Sign up to request clarification or add additional context in comments.

Comments

0

i think the problem is you are trying to use blade syntax in controller.

use this code this will work

 if(($data->Prophylaxis_Indicated)==1){
                echo " <td><span title='true_logo'>
                <img src='images/1-icon.png'
                height='20' width='20'>
                </span></td>";

              }
              else{

               echo "<td> <span title='true_logo'>
               <img src='images/0-icon.png'
               height='20' width='20'>
               </span></td>";
             }

1 Comment

I'd suggest doing it this way: ..src='".asset('images/1-icon.png')."' height='20' width='20'/>...
0

Use double underscore so it may not cz syntax error

 src="url('images/0-icon.png')"

instead

src='url('images/0-icon.png')'

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.