I am trying to build up a CMS. I don't want to use a template, I want to do things a bit more advanced and therefore I will need to make many tables and many rows to achieve the same effect because each page will have a different design.
So, in the index.php I have 7 text fields that I want to be able to be updated via RTE. So I created a table called "page_hem1" on my database where those 7 text fields exist with the names "text1", "text2", etc.
Then I made some basic code for that:
// Query the body section for the proper page
$sqlCommand = "SELECT text1 FROM page_hem WHERE id='$pageid' LIMIT 1";
$query = mysqli_query($myConnection, $sqlCommand) or die (mysqli_error());
while ($row = mysqli_fetch_array($query)) {
$body1 = $row["text1"];
$body2 = $row["text2"];
$body3 = $row["text3"];
$body4 = $row["text4"];
$body5 = $row["text5"];
$body6 = $row["text6"];
$body7 = $row["text7"];
}
mysqli_free_result($query);
My issue is that only the $body1 variable is being echoed. Why aren't the others? What am I doing wrong? You should know that I also tried to repeat the same code sequence for each and every single one of the "$body" variables, but it didn't work out neither. Perhaps i didn't repeat in the right way?
What can I do to echo all the $body's?
Thanks in advance!