oh...I got the random verses working fine...take a look if you want http://www.oursmallgroup.com
Well...let me explain real quick what I am trying to accomplish. Check out the above URL, then go to prayer requests. Look at the header where the date is, then look at the requests themselves. Currently I am running two queries to the DB. One to get the date and one to get the requests.
This is the query to get the date:
SELECT date FROM osg_prayer_request GROUP BY date
This is the query to get the requests:
SELECT pid,uid, main_text FROM osg_prayer_request
This setup worked fine when I only had requests from one date. Now that I have requests from different dates, the query for the date prints out every date that is in the DB. The same thing for the requests. What I want to do is this:
[*] Print the most recent date and prayer requests. The requests could get input almost every day so I would like to group the requests by week. example: everyting from 10-6 to 10-12 would show up on one page.
[*] Print a dropdown menu with the dates pulled from the database, once selected, the user would get a page just like above for the dates selected.
Here is the code I am using to print the requests dropdown menu.
Code:
<form action="<?php echo("$php_self"); ?>" method="post" name="pr_select">
<select name="select_date" onChange="jumpMenu('parent',this,0)" style="font-size: 9;">
<option value="2000-11-02" selected>Past Prayer Requests</option>
<?php
$conn = mysql_connect($dbhost, $dbuser, $dbpass);
if (!$conn) {
echo "<P>Unable to connect to the database server at this time.</P>";
exit();
}
if (! @mysql_select_db($dbname) ) {
echo( "<P>Unable to locate the database at this time.</P>" );
exit();
}
$result = mysql_query("SELECT date from osg_prayer_request GROUP BY date desc;");
if (!$result) {
echo "<P>Error performing query on database";
exit();
}
while ($row = mysql_fetch_array($result)) {
echo "<option value=\"".$row["date"]."\">Week of ".$row["date"]."</option>\n";
}
?>
</select></td></tr></form>
Bookmarks