Subversion-Projekte lars-tiefland.php_share

Revision

Blame | Letzte Änderung | Log anzeigen | RSS feed

<?
        function getNews($limit="",$id="")
        {
                $query="
                        SELECT
                                *,
                                IF (bild_1_url ='', NULL, concat('<img src=".$_SESSION['INI']['news']['imagePath']."1/',bild_1_url,'>')) as bild_1_url,
                                IF (bild_2_url ='', NULL, concat('<img src=".$_SESSION['INI']['news']['imagePath']."2/',bild_2_url,'>')) as bild_2_url,
                                DATE_FORMAT(gueltig_von,'%d.%m.%Y') as Datum
                        FROM
                                news
                        WHERE
                                NOW() BETWEEN gueltig_von AND gueltig_bis
                                AND
                                shops_ID = ".$_SESSION['INI']['shops_ID']."
                                $id
                        ORDER BY
                                gueltig_von desc
                ";
                if (!empty($limit))
                {
                        $query=$query." limit ".$limit;
                }
                
                $buffer=array();
                $result = mysql_query ($query) or die (mysql_errno().": ".mysql_error()."<hr>$query<hr>");
                while($zeile=mysql_fetch_assoc($result))
                {
                        $buffer[]=$zeile;
                }
                return $buffer;
        }
?>