yoda69 Posted June 21, 2007 Share Posted June 21, 2007 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 More sharing options...
ToonMariner Posted June 21, 2007 Share Posted June 21, 2007 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 More sharing options...
yoda69 Posted June 21, 2007 Author Share Posted June 21, 2007 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 More sharing options...
ToonMariner Posted June 21, 2007 Share Posted June 21, 2007 looks like I missed teh opening quote! $haypicture = '<td width="68%"><img src="/GY/images/masters/".$picture." alt="" name="teacher_image" border="0" id="teacher_image"/></td>'; Link to comment https://forums.phpfreaks.com/topic/56533-if-echo-issue/#findComment-279225 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.