Jump to content

Help?


underknown

Recommended Posts

I'm using this code with a free template, after having separated the header, footer, menues etc. into different php files, but the table currently echoes into the sidebar.  Any idea on how to fix this?  I can send the code for the main page or other parts of the page if needed.  Template is here:

 

http://www.2dwebdesign.com/templates/121.html

 

Code here for page:

 

<?php include("header.php"); ?>
<?php include("topmenu.php"); ?>
<?php include("menu.php"); ?>
<?php include("news.php"); ?>
<!-- **** php include news.php, links.php and info.php here to return side menu -->
<div id="column2">
<h1>introduction</h1>
<!-- **** INSERT PAGE CONTENT HERE **** -->
<p>
<?php

echo "Customer Results from Database";

require_once("dbvars.php");

// Connect to the database
$dbc = mysqli_connect(DB_HOST, DB_USER, DB_PW, DB_NAME) or die('Error connecting to MySQL server.');

// Build the query
$query = "SELECT * FROM customers";

$result = mysqli_query($dbc, $query) or die('Error querying database.');

//Table Headers
echo '<table border="1\"><tr>';
echo '<td><b>First Name</b></td>';
echo '<td><b>Last Name</b></td>';
echo '<td><b>Address</b></td>';
echo '<td><b>City</b></td>';
echo '<td><b>Province</b></td>';
echo '<td><b>Postal Code</b></td>';
echo '<td><b>Phone Number</b></td>';
echo '<td><b>Email</b></td>';

//Display Results through Array Loop
While ($row = mysqli_fetch_array($result)) {
echo '<tr><td>' . $row['given_name'] . '</td>';
echo '<td>' . $row['surname'] . '</td>';
echo '<td>' . $row['address'] . '</td>';
echo '<td>' . $row['city'] . '</td>';
echo '<td>' . $row['province'] . '</td>';
echo '<td>' . $row['postal_code'] . '</td>';
echo '<td>' . $row['phone_number'] . '</td>';
echo '<td>' . $row['email'] . '</td>';
}
'</table>';
// Close the database connection
mysqli_close($dbc);


?>

</body>
</html>

Link to comment
https://forums.phpfreaks.com/topic/216307-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.