Hello all -
I host an Ubuntu LAMP Server 8.04. Trying to code a second variant of my micro-blog. My installation script writes to a file database.php with the following configuration:
<?php
$active_group = "default";
$db['default']['hostname'] = "localhost";
$db['default']['database'] = "microBucky";
$db['default']['username'] = "root";
$db['default']['password'] = "password";
?>
I want to display the content from the three columns in my table, which are title, body_text, and created. I have gone through several code variants for the index.php to display my content. Can someone help me out? Displaying content using the mysqli_connect() info at the top of the page. But, I want to use the remote file database.php that my install script created to connect. Here is what I have so far for my index.php
<?
$db = mysql_connect($hostname, $db_user, $db_password);
mysql_select_db($database,$db);
include_once('add_entry/entry.php');
include_once('config/database.php');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!--
microBucky2 is created by Mark Moore at http://buckycomputing.net. All inquiries can be forwarded to mark@buckycomputing.net.
-->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>microBucky2</title>
<link rel="stylesheet" type="text/css" href="appearance.css" />
</head>
<body>
<div id="page-wrap">
<?php
$sql = "SELECT title, microBucky FROM microBucky";
$query = mysql_query($sql);
while($row = mysql_fetch_assoc($query)){
echo $row['title'].'<br />';
echo $row['body_text'].'<br />';
echo $row['created'].'<br />';
echo 'Last modified: ';echo date ('g:i a, j M Y',getlastmod());}
?>
~Mark