Jump to content

If + echo issue


yoda69

Recommended Posts

hi,

 

can someone please help me with this "if" statement. somewhere i'm making a mistake:

 

<?php

 

$haypicture="<td width="68%"><img src=\"/GY/images/masters/<?php echo \"$picture\";?>" alt="" name="teacher_image" border="0" id="teacher_image\"/></td>";

 

if ($rows['picture_id'] == "")

{

echo "

<td width="68%">no picture available</td>";

  }else{

echo "$haypicture";

}

    ?>

 

Thanks guys

Link to comment
https://forums.phpfreaks.com/topic/56533-if-echo-issue/
Share on other sites

yep

 

$haypicture="<td width="68%"><img src=\"/GY/images/masters/<?php echo \"$picture\";?>" alt="" name="teacher_image" border="0" id="teacher_image\"/></td>";

 

change to

 

$haypicture=<td width="68%"><img src="/GY/images/masters/".$picture." alt="" name="teacher_image" border="0" id="teacher_image"/></td>';

 

this assumes you have set $picture before hand

 

Link to comment
https://forums.phpfreaks.com/topic/56533-if-echo-issue/#findComment-279206
Share on other sites

doesn't work.

$picture is already set of course.

 

when i write it like you wrote:

$haypicture=<td width="68%"><img src="/GY/images/masters/".$picture." alt="" name="teacher_image" border="0" id="teacher_image"/></td>';

 

the php designer shows me as if this line has an unfinished quote and the rest of the code is still a part of the variable statement which results in an error page

 

Link to comment
https://forums.phpfreaks.com/topic/56533-if-echo-issue/#findComment-279207
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.