Hi
Vielleicht kann mir jemand helfen.
Dies ist ein Code-Teil vom Geschenke-System. Leider werden neue Geschenke unten angezeigt.
Ich würde gerne die neusten Geschenke an 1. Stelle haben.
Die Frage wäre...was muss geändert werden....das die Abfrage und Ausgabe Geschenke nach dem Datum sortiert ? Irgendwie sort by a.datum ???
Hier der Code:
function onProfileDisplay() {
$document =& JFactory::getDocument();
$this->_user =& CFactory::getActiveProfile();
$this->_my =& CFactory::getUser();
$cont2 = "";
global $my;
if($my->id == $this->_user->id)
{$isMine = true;}
$curid = $this->_user->id;
$profid = intval(JRequest::getVar('userid'));
//get presents
$database = &JFactory::getDBO();
$database->setQuery("SELECT a.id AS presentid, a.userid, a.award, a.date, a.reason,a.donatorid,a.privacy, b.image, b.name, b.desc_text, b.price, c.username FROM #__jpresents_presents AS a LEFT JOIN #__jpresents_gifts AS b ON a.award = b.id LEFT JOIN #__users AS c ON a.donatorid = c.id WHERE a.userid = $curid LIMIT 5");
$gifts = $database->loadObjectList();
//
Im besonderen geht um diesen Bereich hier:
//Geschenke Ausgabe Bfw-Profil
$database = &JFactory::getDBO();
$database->setQuery("SELECT a.id AS presentid, a.userid, a.award, a.date, a.reason,a.donatorid,a.privacy, b.image, b.name, b.desc_text, b.price, c.username FROM #__jpresents_presents AS a LEFT JOIN #__jpresents_gifts AS b ON a.award = b.id LEFT JOIN #__users AS c ON a.donatorid = c.id WHERE a.userid = $curid LIMIT 5");
$gifts = $database->loadObjectList();
In der Ausgabe ist a.datum als Datum deklariert.
WHERE a.datum = ???? Oder sowas in der Art
Oder sowas... SELECT * #__jpresents_presents WHERE Startzeit > NOW() ORDER BY startzeit ASC LIMIT 10;
Lg Alex