Andrew R Posted April 9, 2007 Share Posted April 9, 2007 Hi How would I insert this (below) inside an echo that contains html? <?php do { ?> <?php } while ($row_bh = mysql_fetch_assoc($bh)); ?> <? if ($ree == 'YES') { echo"<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"bar\"> <!--DWLayoutTable--> <tr> <td width=\"249\" height=\"18\" valign=\"top\"><strong>TEEST</strong> </td> <td width=\"590\"></td> </tr> </table> <table width=\"100%\" border=\"0\" cellpadding=\"2\" cellspacing=\"3\" bgcolor=\"#F5F5F5\" class=\"border\"> <!--DWLayoutTable--> <tr> <td width=\"121\" height=\"22\" valign=\"top\" bgcolor=\"#CCCCCC\" class=\"bar2\">1 </td> <td width=\"95\" valign=\"top\" bgcolor=\"#CCCCCC\" class=\"bar2\">2</td> <td width=\"96\" valign=\"top\" bgcolor=\"#CCCCCC\">3</td> <td width=\"93\" valign=\"top\" bgcolor=\"#CCCCCC\">4</td> <td width=\"96\" valign=\"top\" bgcolor=\"#CCCCCC\">5</td> <td width=\"100\" valign=\"top\" bgcolor=\"#CCCCCC\">6</td> <td width=\"104\" valign=\"top\" bgcolor=\"#CCCCCC\">7e</td> <td width=\"77\" valign=\"top\" bgcolor=\"#CCCCCC\" class=\"bar2\"><!--DWLayoutEmptyCell--> </td> </tr> <tr> <td height=\"23\" valign=\"middle\"></td> <td valign=\"top\"><td> <td valign=\"top\">< td> <td valign=\"top\"></td> <td valign=\"top\"></td> <td valign=\"top\"></td> <td valign=\"top\"></td> <td align=\"right\" valign=\"middle\"><!--DWLayoutEmptyCell--> </td> </table>"; } ?> How would I put the php inside the echo without getting errors Cheers Link to comment https://forums.phpfreaks.com/topic/46352-php-inside-echos/ Share on other sites More sharing options...
HaLo2FrEeEk Posted April 9, 2007 Share Posted April 9, 2007 You want to actually print the code to the page, or you want to print the result of the code? Link to comment https://forums.phpfreaks.com/topic/46352-php-inside-echos/#findComment-225479 Share on other sites More sharing options...
fert Posted April 9, 2007 Share Posted April 9, 2007 you can't, you would do something like this echo "<table>"; while ($row_bh = mysql_fetch_assoc($bh)); { echo "<tr><td>{$row_bh['value']}</td></tr>"; } echo "</table>"; Link to comment https://forums.phpfreaks.com/topic/46352-php-inside-echos/#findComment-225480 Share on other sites More sharing options...
SiC_Goat Posted April 9, 2007 Share Posted April 9, 2007 If you don't want to escape all those quotes you can always do <? if ( $boolean ) { ?> Lots of html and stuff could go here like this<br /> <?= $var ?> is also a cool shortcut to embedding php into HTML without having to type out a whole lot. <img src="img.jpg" alt="nowai" /> <? } ?> Link to comment https://forums.phpfreaks.com/topic/46352-php-inside-echos/#findComment-225482 Share on other sites More sharing options...
Andrew R Posted April 9, 2007 Author Share Posted April 9, 2007 You want to actually print the code to the page, or you want to print the result of the code? No just the results of the code. Link to comment https://forums.phpfreaks.com/topic/46352-php-inside-echos/#findComment-225485 Share on other sites More sharing options...
HaLo2FrEeEk Posted April 12, 2007 Share Posted April 12, 2007 Then do what fert said, php will never print itself to the page unless you tell it to, it will only ever print the results. Link to comment https://forums.phpfreaks.com/topic/46352-php-inside-echos/#findComment-227954 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.