MySQL Query, maar hoe?

Status
Niet open voor verdere reacties.

boemboem

Gebruiker
Lid geworden
10 feb 2003
Berichten
100
Hoi,

ik zit met het volgende... ik weet niet superveel van PHP, MySQL maar ik moet het volgende hebben... er is in mijn database een tabel met "events'. Nu staat er een rij in met "onetime_date".
Het formaat is "date" (0000-00-00). Nu is mijn vraag: ik moet de variabelen MAAND, DAG en JAAR (in NL of ENGELS) uit die rij zien te krijgen, maar weet niet hoe dat moet. De broncode van het PHP bestand staat hieronder:

Code:
<?php

/********************************************************/
/*                                                      */
/* Edited and modified for PHP-Nuke 5.5 by Nuketest.com */
/*                                                      */
/********************************************************/
/* Event Calendar                                       */
/* Version 1.5, see history.txt for details             */
/* Originally by Rob Sutton                             */
/* Development continued by                             */
/*    Aleks A.-Lessmann (aleks@lessmann-consulting.com) */
/*                                                      */
/* This program is opensource so you can do whatever    */
/* you want with it. However, I'm happy about any       */
/* clever idea or nifty change you might have or have   */
/* done, send them to                                   */
/* [email]calendar-module@lessmann-consulting.com[/email]              */
/* Any new versions can be found at                     */
/* [url]http://www.lessmann-consulting.com[/url] first             */
/********************************************************/

/********************************************************/
/*                                                      */
/* Modified by VY (vy@kalorama.net)                     */
/* to select only Birthdays in the                      */
/* next three months                                    */
/*                                                      */
/* To choose the category shown, edit the topic number  */
/* in both mysql_query statements. For example,         */
/* my 'birthdays' category is topic '37'                */
/* You can also expand or contract the month range      */
/* chosen in the query statements (I chose 3).          */
/*                                                      */
/********************************************************/


if (eregi("block-Birthdays.php",$PHP_SELF)) {
    Header("Location: index.php");

    die();
}

$module_name = "NuCalender";

$Date = Date("m/d/Y");

$Date_Array = explode("/", $Date);

$todaycolor = "#778899";

$daycolor = "#000000";

$daybackground = "#FFFFFF";

$todaybackground = "#FF5555";

$content = "";

global $prefix, $currentlang;

include("modules/$module_name/language/lang-$currentlang.php");

$eventsresult = mysql_query("SELECT id,title,onetime_date FROM nuke_nucal_events WHERE (MONTH(onetime_date) - MONTH(NOW()) <= 1) AND (MONTH(onetime_date) - MONTH(NOW()) >= 0) AND categoryid = '2' ORDER BY MONTH(onetime_date), onetime_date, title"); 

$result = mysql_query("SELECT DATE_FORMAT(onetime_date, '%b %D') as formatted_date FROM nuke_nucal_events WHERE (MONTH(onetime_date) - MONTH(NOW()) <= 1) AND (MONTH(onetime_date) - MONTH(NOW()) >= 0) AND topic = '2' ORDER BY MONTH(onetime_date), onetime_date, title"); 

if (mysql_num_rows($eventsresult) == 0) 

        {

        $content .= "<center><font class=\"content\">"._CALNOEVENTS."</font></center>";
 
        }

 else
        {  
           $content .= "<center></center>"; 
    while(list($eid, $title,$barcolor, $eventDate) = mysql_fetch_row($eventsresult))
 
         {

         if ($barcolor == "r") $barcolorchar="r";

         elseif ($barcolor == "g") $barcolorchar="g";

         elseif ($barcolor == "b") $barcolorchar="b";

         elseif ($barcolor == "y") $barcolorchar="y";

         else $barcolorchar="w";

         $row = mysql_fetch_array($result);
					  
         $content .= "<center>* <a href=\"modules.php?name=$module_name&op=ShowEvent&month=$MONTH(onetime_date)&day=$DAY(onetime_date)&year=$YEAR(onetime_date)&eventid=$id\">$title</a><br> $row[formatted_date]</center>";

          }

        } 

?>

nu wil ik die variabelen $MONTH, $DAY en $YEAR dus uit die onetime_date rij krijgen. Weet iemand hoe dat moet???

alvast bedankt!
 
Dit misschien:

SELECT date_format(kolom, '%d %m, %Y') FROM tabel;

Dit moet je dan maar zelf even aanpassen. 'tabel' staat voor de naam van je tabel en 'kolom' voor de kolom.
 
Status
Niet open voor verdere reacties.
Terug
Bovenaan Onderaan