I have for some time tried to create a admin panel view of things where a user can insert things to then get posted on the website. Kind of a smaller version of wordpress, right now mostly for private and educational use. However, I can't get it to post the content that is sent to the database from the adminpanel view of things. It won't display anything at all, which makes me think I am doing something critically wrong.
This is what I got : (Connection)
<?php
session_start();
$adress = 'Host adress goes here';
$dbusername = 'Database username goes here';
$dbpassword = 'Database password goes here';
$anslutning = mysqli_connect($host, $dbusername, $dbpassword);
if (!$anslutning) die ("<br /><b>Can't connect to server</b>");
$anslutning->select_db('Database name goes here') or die ("Could not connect to database");
?>
And the code I currently can't get to work
<p class="welcometext">
<?php
$getContentQuery = "SELECT content FROM tblPages";
if ($getContent = $anslutning->prepare($getContentQuery)) {
$getContent->execute();
$result = $anslutning->query($getContentQuery);
while ($rows = mysql_fetch_array($result)) {
echo $rows[2];
}
}
?>
</p>
**EDIT:**I just realised it does not echo out anything inside the if statement, so as a newbie to PHP I'm not sure if it is supposed to do so, or if this is why 'while' is not working.
EDIT2: So I have gotten my answer and ticket it. However, I need to add something to it. While what I had written was wrong from the beginning, removing all earlier PHP code seemed to fix the problem (Let the troubleshooting commence!). I appreciate everyones help and time, and as long as i can figure what is breaking it, the issue is solved.