<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name = "description" content = "Wellington Real Estate"/>
<meta name = "keywords" content = "home, housing, Karori, Mirimar, Te Aro, Thorndon, Farcourts, Jonnys, Relax"/> 
<title> Agents </title>
<link rel = "stylesheet" type = "text/css" href = "assessment.css"/>
</head>

<body>
<div id = "wrapper">
<div id = "container">
<div id = "banner">
<h1>The Wellington Real Estate Company</h1>
</div>
<div id = "left">
<a href = "Index.html">Home</a>
<a href = "Agents.html">Agents</a>
<a href = "Suburbs.html">Suburbs</a>
</div>
<div id = "right">
<br/>
<h2>Listing of Houses by Agent</h2>
<p>All our agents are currently listing a range of properties. Please click on one of the links to see that agent's listings: </p><br/>
<a href = "Farcourts.php">Farcourts</a>

<a href = "Jonnys.html">Jonnys</a>
<a href = "Relax.html">Relax</a>
</div>
</div>
</div>
</body>
</html>



<body>
<div id = "wrapper">
<div id = "container">
<div id = "banner">
<h1>The Wellington Real Estate Company</h1>
</div>
<div id = "left">
<a href = "Index.html">Home</a>
<a href = "Agents.html">Agents</a>
<a href = "Suburbs.html">Suburbs</a>
</div>
<div id = "right">
<br/>
<h2>Listing of Houses by Agent</h2>
<p>All our agents are currently listing a range of properties. Please click on one of the links to see that agent's listings: </p><br/>
<a href = "Farcourts.php">Farcourts</a>

<a href = "Jonnys.html">Jonnys</a>
<a href = "Relax.html">Relax</a>
</div>
</div>
</div>
</body>
</html>

and the php coding

    <head>
    </head>
    <body>
    <table border='1'>
    <tr>
    <th>Agent_ID</th>
    <th>Address</th>
    <th>Bedrooms</th>
    <th>Price</th>
    <?php
    $connect=mysql_connect("localhost","root","");
    $db_selected = mysql_select_db("ong_assessment", $connect);
    $query = "SELECT Agent_ID,Address,Bedrooms,Price FROM harcouts";
    $result = mysql_query($query) or die(mysql_error());
    if(!mysql_affected_rows() >= 1)
    {
    echo 'There are no entries inside the database';
    }
    while($row = mysql_fetch_array($result))
    {
    echo '<tr>';
    echo '<td>'. $row['Agent_ID'].'</td>';
    echo '<td>'. $row['Address'].'</td>';
    echo '<td>'. $row['Bedrooms'].'</td>';
    echo '<td>'. $row['Price'].'</td>';
    }
    echo '</table>';
    ?>
    </body>
    </html>

how can i link both of them togather?

Before you begin to integrate PHP within this HTML...

This is wrong:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name = "description" content = "Wellington Real Estate"/>
<meta name = "keywords" content = "home, housing, Karori, Mirimar, Te Aro, Thorndon, Farcourts, Jonnys, Relax"/> 
<title> Agents </title>
<link rel = "stylesheet" type = "text/css" href = "assessment.css"/>
</head>

<body>
<div id = "wrapper">
<div id = "container">
<div id = "banner">
<h1>The Wellington Real Estate Company</h1>
</div>
<div id = "left">
<a href = "Index.html">Home</a>
<a href = "Agents.html">Agents</a>
<a href = "Suburbs.html">Suburbs</a>
</div>
<div id = "right">
<br/>
<h2>Listing of Houses by Agent</h2>
<p>All our agents are currently listing a range of properties. Please click on one of the links to see that agent's listings: </p><br/>
<a href = "Farcourts.php">Farcourts</a>

<a href = "Jonnys.html">Jonnys</a>
<a href = "Relax.html">Relax</a>
</div>
</div>
</div>
</body>
</html>



<body>
<div id = "wrapper">
<div id = "container">
<div id = "banner">
<h1>The Wellington Real Estate Company</h1>
</div>
<div id = "left">
<a href = "Index.html">Home</a>
<a href = "Agents.html">Agents</a>
<a href = "Suburbs.html">Suburbs</a>
</div>
<div id = "right">
<br/>
<h2>Listing of Houses by Agent</h2>
<p>All our agents are currently listing a range of properties. Please click on one of the links to see that agent's listings: </p><br/>
<a href = "Farcourts.php">Farcourts</a>

<a href = "Jonnys.html">Jonnys</a>
<a href = "Relax.html">Relax</a>
</div>
</div>
</div>
</body>
</html>

i accidentally paste two times

Apologies..

It depends where you want to display the information, at one point..

then it could be as simple as (an example):

<div id="phpContent"> 
<table border='1'>
    <tr>
    <th>Agent_ID</th>
    <th>Address</th>
    <th>Bedrooms</th>
    <th>Price</th>
    <?php
    $connect=mysql_connect("localhost","root","");
    $db_selected = mysql_select_db("ong_assessment", $connect);
    $query = "SELECT Agent_ID,Address,Bedrooms,Price FROM harcouts";
    $result = mysql_query($query) or die(mysql_error());
    if(!mysql_affected_rows() >= 1)
    {
    echo 'There are no entries inside the database';
    }
    while($row = mysql_fetch_array($result))
    {
    echo '<tr>';
    echo '<td>'. $row['Agent_ID'].'</td>';
    echo '<td>'. $row['Address'].'</td>';
    echo '<td>'. $row['Bedrooms'].'</td>';
    echo '<td>'. $row['Price'].'</td>';
    }
    echo '</table>';
    ?>
    </div>

I suppose it's bad to have HTML/PHP together, in this respect. So it might be better to include this using include('foo.php'); BUT it depends where you want the content to be shown. I haven't seen your page etc.. Remember to save the page as .php instead of .html if you're using PHP.

i still dont understand

what does this <div id="phpContent"> means?

hi dean!!!! The assement is due tomorrow!!!

commented: Busted!! +0
Hi

Try to keep the database connection page seperately like below, I hope this will help you want you expect. Check the syntax

**Step:1**

*config.php*

<?php 

$hostname = 'localhost';
$dusername = 'root';
$password = '';
$database = 'ong_assessment';

$conn = mysql_connect($hostname, $dusername, $password) or die(mysql_error());
mysql_select_db($database, $conn);
?>

**Step:2**

*main.php*

<?php include("config.php"); ?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name = "description" content = "Wellington Real Estate"/>
<meta name = "keywords" content = "home, housing, Karori, Mirimar, Te Aro, Thorndon, Farcourts, Jonnys, Relax"/>
<title>Agents</title>
<link rel = "stylesheet" type = "text/css" href = "assessment.css"/>
</head>

<body>
<div id = "wrapper">
  <div id = "container">
    <div id = "banner">
      <h1>The Wellington Real Estate Company</h1>
    </div>
    <div id = "left"> <a href = "Index.html">Home</a> <a href = "Agents.html">Agents</a> <a href = "Suburbs.html">Suburbs</a> </div>
    <div id = "right"> <br/>
      <h2>Listing of Houses by Agent</h2>
      <p>All our agents are currently listing a range of properties. Please click on one of the links to see that agent's listings: </p>
      <br/>
      <a href = "Farcourts.php">Farcourts</a> <a href = "Jonnys.html">Jonnys</a> <a href = "Relax.html">Relax</a> </div>
    <table border='1'>
      <tr>
        <th>Agent_ID</th>
        <th>Address</th>
        <th>Bedrooms</th>
        <th>Price</th>
      </tr>

      <?php 
            $query = "SELECT Agent_ID,Address,Bedrooms,Price FROM harcouts";
            $result = mysql_query($query);
            if(!mysql_affected_rows() >= 1)
                {
                    echo 'There are no entries inside the database';
                }
            else 

                while($row = mysql_fetch_array($result))
                    {
        ?>
      <tr>
        <th><?php echo $row['Agent_ID']; ?></th>
        <th><?php echo $row['Address']; ?></th>
        <th><?php echo $row['Bedrooms']; ?></th>
        <th><?php echo $row['Price']; ?></th>
      </tr>
      <?php } ?>
    </table>
  </div>
</div>
</body>
</html>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.