Psalms

[insert_php]

$today = getdate();
echo “

“;
printf(“Today is %s, %s %d, %s
“, $today[weekday], $today[month], $today[mday], $today[year]);
echo “

“;
$link = mysqli_connect(“68.178.253.32”, “d2d23622742927”, “qHvQW}}gp6-L”, “d2d23622742927”, 3311);
//should seed the random value the same for each day
srand($today[“mday”] + $today[“mon”] + $today[“year”]);

$psalm_num = rand(1, 150);

/* Select queries return a resultset */
if ($result = mysqli_query($link, “SELECT * FROM psalm_otd WHERE psalm_otd_id = $psalm_num”)) {
// printf(“Select returned %d rows.\n”, mysqli_num_rows($result));
}
/* associative array */
//$row = $result->fetch_array(MYSQLI_ASSOC);
//printf (“%s %s
“, $row[“psalm_otd_id”], $row[“psalm_text”]);
while ($row = $result->fetch_array(MYSQLI_ASSOC))
{
echo “

Psalm ” . $row[“psalm_otd_id”] . ” (KJV)
“;
echo $r[“intro_text”] . “

“;
echo ereg_replace(“([0-9]+)”, “
\\0″, $row[“psalm_text”]) . “

“;
}
/* free result set */
mysqli_free_result($result);
mysqli_close($link);

[/insert_php]