ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Have a MySQL / Query Module question

February 19, 2010 4:53am

Subscribe [1]
  • #1 / Feb 19, 2010 4:53am

    jaasum

    36 posts

    I am a newbie with PHP, MySQL, and running queries etc so I am hoping someone here can at least point me in the right direction.

    I am in the processes of doing a site redesign for a client. They currently have a “scripture of the day” type feature on their church website. This currently is pulling from a table in their site’s database. All I currently have is a CSV file with a line for each day of the year that looks like this.

    1;"1";"1";"Genesis 1-2";"Luke 1";;

    Where 1 = day of the year 1=january and 1= the 1st of the month, then there are two verses for that day; Genesis 1-2 and Luke 1. This data is then passed through the url to biblegateway.com

    The PHP function on their existing site looks like this.

    function getreading() {
        $month = date("m");
        $day = date("d");
        $result = mysql_query("SELECT * FROM `scriptures` WHERE `month` = '$month' AND `day` = '$day'");
        $verse = mysql_fetch_array($result);
            $reading = "<ul>\r\n\t\t";
            if ($verse[verse1]) {$reading .= "<li><a >$verse[verse1]</a></li>\r\n\t\t"; };
            if ($verse[verse2]) {$reading .= "<li><a >$verse[verse2]</a></li>\r\n\t\t"; };
            if ($verse[verse3]) {$reading .= "<li><a >$verse[verse3]</a></li>\r\n\t\t"; };
            if ($verse[verse4]) {$reading .= "<li><a >$verse[verse4]</a></li>\r\n\t\t"; };
            $reading .= "</ul>\r\n";
            return $reading;
        }

    What I am wondering, is how do I either use this CSV file, or import it into my database, then, would I be able to use the query module to pull the daily results?

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases