I am trying to get some data from my database to put it on my website. My database has the following rows: id, type(titel,image,paragraph),pagename and the content(for an example if you choose titel as type you put html code in there to show a h1). I have tried something but that did not work. Can you guys help me out? My code :
$connect = mysql_connect("localhost", "root", "root");
$select_data = mysql_select_db('portfolio', $connect);
$select_data = mysql_query("SELECT * FROM page_directory WHERE pagename='index' id='1'") or die(mysql_error());
while($fetch=mysql_fetch_assoc($select_data)) {
$oDiv = $dom->getElementById('contentContainer');
$oH1 = $dom->createElement('h1',$fetch["content"]);
$oDiv->appendChild($oH1);
}