Forum Moderators: coopster
This wouldn't work either because you need to quote the values:-
$sql = "select pageText, updateDate from pages where id ='$id'";
Just ensure as you have quoted the column names correctly,
eg the database contains the footer division: ....
I want the $date to display on the webpage
<?php
// Set these to null, just in case
$footer=$date=$pageText=null;
//
//Get the footer
$sql = "select divText from standardContent where division = 'footer'";
$rs = mysql_query($sql,$conn) or die("could not query for footer");
if ($row = mysql_fetch_array($rs)) {
$footer = $row['divText'];
}
else { echo "Could not get footer"; }
//
//get the main page text with its date
$sql = "select pageText, updateDate from pages where id = $id";
$rs = mysql_query($sql,$conn) or die("could not get page text and date");
if ($row = mysql_fetch_array($rs)) {
$date = $row['updateDate'];
$pageText = $row['pageText'];
}
else { echo "could not get date and page text"; }
//print them out
echo "$pageText $date $footer";
?>
<div id="footer">
<p>© $date <a href="index.php">Bovine Trypanosomiasis Consortium</a> </p>
</div>