HTML Stack

Is it ok to put php code into the HTML stack ?

If put this code:


$hostname = "localhost";
$username = "mouseflo_admin";
$password = "********";
$db = "mouseflo_courses";


if ($dbconnect->connect_error) {
  die("Database connection failed: " . $dbconnect->connect_error);


<table border="1" align="center" cellpadding=5 cellspacing=5>
 <td><b>Course Title</b></td>
  <td><b>Start Date<b></td>
  <td><b>End Date</b></td>


$query = mysqli_query($dbconnect, "SELECT css_multi_lang.content AS coursetitle, date_format(css_classes.start_date,'%D %M %Y') AS startdate,date_format(css_classes.end_date,'%D %M %Y') AS enddate FROM css_multi_lang JOIN css_courses ON css_multi_lang.foreign_id = JOIN css_classes ON css_multi_lang.foreign_id = css_classes.course_id WHERE css_courses.status = 'T' AND css_multi_lang.field = 'title' AND css_multi_lang.model = 'pjCourse'")
   or die (mysqli_error($dbconnect));

while ($row = mysqli_fetch_array($query)) {



Into an HTML stack and then add the stack to the page it seems to want to consume other stacks on that page. I am guessing I am not doing this the right way. Any guidance would be most appreciated.

You should be Ok.

Just highlight all the PHP code - from the <?php to the ?> tags and then mark it as “Ignore Formatting”.

It is under one of the RW menus - just not exactly sure at the moment as I am not near the computer I have it on.

Ok. So it is under the “Format” menu (duh)

Don’t forget to include the opening and closing PHP tags.

looks like you are trying to connect to a MySQL database? That’s probably why you’re getting errors (consume stacks). I don’t think you can Connect to a MySQL database in edit or preview mode.

Might want to give a clue as to what you are looking to do.

If it is doing that then you must have an unclosed tag in the code, which would be the closing bold tag on the Start Date line

1 Like

when this HTML stack is on its own on a page it works perfectly. It only misbehaves both visually (looks like it puts other stacks inside itself in edit mode) and when published the page does not function at all.

I don’t see a closing </table>. I might be missing it.

1 Like

You are correct - I am only on my mobile so there may be others that I missed. Whatever, @mp1963 you must make absolutely sure that your HTML is valid or you will break subsequent stacks on the page.

1 Like

Thank you all. I went through the code again and fixed all the missing tags. Everything works as expected now. The moral of this story is don’t write code when you are very tired … Thank you all for your assistance.