basically i created 2 files, one to query the database :-
Code:
<?php
// The following constants define the username, password, host and database.
// Edit as needed
define ('DB_USER', 'username'); // Database Username
define ('DB_PASSWORD', 'password); // Database Password
define ('DB_HOST', 'localhost'); // Server, will be 'localhost' 99% of the time
define ('DB_NAME', 'database_kayako'); // Database Name
// Do Not Edit below this line
#########################################
// Connect to MySQL
$dbc=mysql_connect (DB_HOST, DB_USER, DB_PASSWORD) or die ('I cannot connect to the database because: ' . mysql_error());
// Select the database
mysql_select_db (DB_NAME) or die ('I cannot select the database becuase: ' . mysql_error());
?>
i saved this as config.php
then i created the news.php which i would use an iframe in my main homepage to display
Code:
<html>
<head>
<link href="main.css" rel="stylesheet" type="text/css">
</head>
<body bgcolor="#EFF3F7">
<?php
require_once ('config.php'); // connect to mysql and select the database
$sql = "SELECT newsid, subject, description FROM swnews ORDER BY newsid DESC ";
$result = mysql_query($sql) or die(mysql_error()); // Run the query, or print error message
?>
<table width="130" border="0" cellpadding="0" cellspacing="0" bgcolor="#EFF3F7" style="FSB">
<tr>
<td width="130" height="179" valign="top" wrap class="leftoptions"><?php
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { // Make results from the query into an array
echo "strong />$row[subject]</strong /><br />$row[description]"
."<br /><hr class=\"underline\" />\n"
."<br />\n";
}
?></td>
</tr>
</table>
</body></html>
These files make references to my css file so you will need to edit to suit your own needs, im looking at adding a date in there as well. But like i said my knowledge is very limited so im quite pleased i managed this, someone with more experience would probably know a better way.
heres how i called it to my index.html page
Code:
<td class="FSB"><iframe SCROLLING="auto" SRC="http://www.YOURDOMAIN.net/news.php" FRAMEBORDER="0" width="173" height="100" valign="top"></iframe></td>
hope this is useful to anyone
