$sermonFound = 0;
if (isset($_GET[‘sermontitle’])) {
$sermontitle = $_GET[‘sermontitle’];
$query = “SELECT * FROM `wbfc3300`.`sermons` where sTitle='”.($_GET[‘sermontitle’]).”‘”;
}
else {
$query = “select * from sermons order by sDate desc limit 1”;
}
$link = mysqli_connect(‘whitehall.church’, ‘wbfc3300’, ‘REDSreds1005!!’);
if (!$link) {
echo “Error: Unable to connect to MySQL.” . PHP_EOL;
echo “Debugging errno: ” . mysqli_connect_errno() . PHP_EOL;
echo “Debugging error: ” . mysqli_connect_error() . PHP_EOL;
exit;
}
mysqli_select_db($link, “wbfc3300”);
$result = mysqli_query($link, $query);
if (!$result) {
$message = ‘Invalid query: ‘ . mysqli_error() . “\n”;
$message .= ‘Whole query: ‘ . $query;
die($message);
echo “Could not connect to the table!”;
}
while ($row = mysqli_fetch_assoc($result)) {
$sermonFound = $sermonFound + 1;
$sDate = $row[‘sDate’];
$sTitle = $row[‘sTitle’];
$sSeries = $row[‘sSeries’];
$sText = $row[‘sText’];
$sDesc = $row[‘sDesc’];
$sNotes = $row[‘sNotes’];
$sAduio = $row[‘sAudio’];
$sAudio_Duration = $row[‘sAudio_Duration’];
$sResearch = $row[‘sResearch’];
$sKeywords = $row[‘sKeywords’];
$sSpeaker = $row[‘sSpeaker’];
$sSpeakerURL = $row[‘sSpeakerURL’];
$sVideo = $row[‘sVideo’];
$sVideo_Preview = $row[‘sVideo_Preview’];
$sVimeo = $row[‘sVimeo’];
$sVimeo_Download = $row[‘sVimeo_Download’];
$sYouTube = $row[‘sYouTube’];
$sChurch = $row[‘sChurch’];
$sPageURL = $row[‘sPageURL’];
$sTranscript = $row[‘sTranscript’];
}
$result->close();
mysqli_close($link);
// =====================================================
// NOW DISPLAY THE DATABASE CONTENT
if ($sermonFound <> 0) {
echo ”
“.$sTitle.”
“;
echo “Date: “.$sDate.”
“;
echo “Series: “.$sSeries.”
“;
echo “Text: “.$sText.”
“;
echo “Description: “.$sDesc.”
“;
echo “Notes: “.$sNotes.”
“;
echo “Audio: “.$sAudio.”
“;
echo “Playtime: “.$sAudio_Duration.”
“;
echo “Research: “.$sResearch.”
“;
echo “Keywords: “.$sKeywords.”
“;
echo “Speaker: “.$sSpeaker.”
“;
echo “Speaker URL: “.$sSpeakerURL.”
“;
echo “Video: “.$sVideo.”
“;
echo “Video Preview Pic: “.$sVideo_Preview.”
“;
echo “Vimeo: “.$sVimeo.”
“;
echo “Vimeo Download: “.$sVimeo_Download.”
“;
echo “Youtube: “.$sYouTube.”
“;
echo “Church: “.$sChurch.”
“;
echo “Page: “.$sPageURL.”
“;
echo “Transcript “.$sTranscript.”
“;
}
[/php]