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
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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.