I am trying to integrate a very basic php site into an existing html website to create a blog. I have one page where I can enter info which is then published onto a page called blogentries.php which works fine on it's own. I want the info to be published into the blogentries div on my website that says "I WANT BLOG ENTRIES HERE" close to the bottom.
I thought it would be a simple case of making the connection to the database in the header and put the rest of the php into the div, but obviously there is more to it than that.
I was wondering if someone could look at the code for the two pages and explain how it should be done?
Thank you
blogentries.php
<?php
mysql_connect("localhost:8889","root","root");
mysql_select_db("Alexweb");
echo "<html><head><link rel='stylesheet' href='style.css' type='text/css'></head><body>";
$query = "select * from content";
echo "<p>Query: ".$query;
$result = mysql_query($query);
$rows = mysql_num_rows($result);
for($i=0;$i<$rows;$i++) {
$row = mysql_fetch_array($result);
echo "<div class='".$row['class']."'>";
echo "<p> Date: ".$row['date']."</p>";
echo "<p><h3>".$row['title']."<⁄h3></p>";
echo "<p><img src='".$row['image']."'></p></div><p></p>";
echo "<p>".$row['text']."</p>";
}
echo "</body></html>";
?>
blogpage in html
<!doctype html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>AJWatson - Blog</title>
<meta name="keywords" content=" art design, digital media design, graphic design, logo design, ">
<link rel="shortcut icon" href="favicon.ico" />
<!-- Load CSS -->
<link href="css/style.css" rel="stylesheet" type="text/css" />
<!-- Load Fonts -->
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Droid+Serif:regular,italic,bold,bolditalic" type="text/css" />
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Droid+Sans:regular,bold" type="text/css" />
</head>
<body>
<!--This is the START of the header-->
<div id="topcontrol" style="position: fixed; bottom: 5px; left: 960px; opacity: 1; cursor: pointer;" title="Go to Top"></div>
<div id="header-wrapper">
<div id="header">
<div id="logo"><a href="index.html"><img src="images/logo.png" width="100" height="80" alt="logo" /></a></div>
<div id="header-text">
<h4>Blog</h4>
<h6><a href="index.html">Home</a> → Blog</h6>
</div>
</div>
</div>
<!--END of header-->
<!--This is the START of the menu-->
<div id="menu-wrapper">
<div id="main-menu">
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="about.html">About</a></li>
<li><a href="portfolio.html">Portfolio</a></li>
<li><a class="selected" href="blog.html">Blog</a></li>
<li><a href="contact.html">Contact</a></li>
</ul>
</div>
<!--This is the START of the footer-->
<div id="footer">
<div id="social-box">
<ul>
<li>
<div class="facebook"><a href=""></a></div>
</li>
<li>
<div class="twitter"><a href=""></a></div>
</li>
<li>
<div class="linkedin"><a href=""></a></div>
</li>
</ul>
</div>
<h6></h6>
</div>
<!--END of footer-->
</div>
<!--END of menu-->
<!--This is the START of the content-->
<div id="content">
<!--This is the START of the blog-->
<div id="blogentries">
I WANT BLOG ENTRIES HERE
</div>
<!--END of blog-->
</div>
<!--END of content-->
</div>
</body>
</html>





