- Code: Select all
<!-- START index.php -->
<?php // Check for page_id from header info
$fetcher = $_REQUEST[page_id]
?>
<?php // If header is empty assume id = 1, otherwise header = header value
if ($fetcher == "") {
$page="1";
} else {
$page=$fetcher;
}
?>
<?php // Connect to the Database
$dbcnx = @mysql_connect('localhost', 'root', '');
if (!$dbcnx) {
exit('<p>Unable to connect to the ' .
'database server at this time.</p>');
}
// Select the database
if (!@mysql_select_db('slbm_v1')) {
exit('<p>Unable to locate the ' .
'database at this time.</p>');
}
?>
<?php // Select the table and perform the query
// Select all from table
$result = @mysql_query("SELECT * FROM Main_Articles WHERE Page_id = \"$page\"");
if (!$result) {
exit('<p>Error performing query: ' . mysql_error() . '</p>');
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>
</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php // Output
while ($row = mysql_fetch_array($result)) {
echo $row['Article_title'] . '</br></br>' . $row['Article_data'];
} ?>
</body>
</html>
What i would like to be able to do is to insert $row[Image_url] for example (from the above query/table) and place it say at the bottom of the page. This is possible if i made the whole page PHP, but it would be much easier to do the bulk of it in HTML for the design side, then just put in PHP snippets where required. Does anyone know a way of doing this? I thought simply putting <?php echo $row[Image_url] ?> might work, but no joy.
Thanks as always for your help. You guys are the PHP dons!


