newbie question

From: Date: Fri, 13 Feb 2004 22:43:39 +0000
Subject: newbie question
Groups: php.db 
Request: Send a blank email to php-db+get-32948@lists.php.net to get a copy of this message
hi, i am relatively new to php and new to this email list. i have what i think are fairly simple questions about using mysql and php. i have done some research and can't seem to find the answer i need. # 1. i want to set the date format to display dates in a format other than the standard mysql yyyy-mm-dd format. i have tried using the mysql DATE_FORMAT but i can's seem to get it to work... ideally i'd like to display dates as 2 digit date followed by three letter month abbreviation and leave the year off completely... example: 13 feb # 2. i want to hide entries that are newer than the current date AND hide entries older than 365 days. i apologize if this is the wrong place to ask these questions. if someone could point me in the right direction i would appreciate it. here is the url and code (minus the login info) http://www.broadcastatic.com <?php $db = mysql_connect("localhost", "[loginnamehere]", "[passwdhere]"); mysql_select_db("[databasenamehere]",$db); // display individual record if ($date) { $result = mysql_query("SELECT * FROM [tablenamehere] WHERE date= '$date' ",$db); $myrow = mysql_fetch_array($result); // do not use now printf("<img src=\"../images/icons/%s.gif\"><br>\n", $myrow["date"]); printf("hosted by %s<br>\n", $myrow["dj"]); printf("broadcast on %s<br>\n", $myrow["date"]); printf("%s\n<br><br><br>", $myrow["location"]); printf("--> %s\n<br><br>", $myrow["entry"]); printf("<a href=\"archive/mp3/$date.mp3\">mp3 link</a>\n<br><br>", $myrow["date"]); include("archive/index/$date.php"); } else {
    // display list of shows by date
$result = mysql_query("SELECT * FROM [tablenamehere] WHERE 1 ORDER BY 'date' DESC",$db);
    if ($myrow = mysql_fetch_array($result)) {
      // display list if there are records to display
      do {
        printf("<div id=\"col1\"><a href=\"%s?date=%s\">%s</a> </div>
                   <div id=\"col2\"><img src=\"archive/images/icon/%s.gif\"> </div>
                   <div id=\"col3\"><b>%s</b><br>%s</div><br>\n",
                   $PHP_SELF, $myrow["date"], $myrow["date"], $myrow["date"], $myrow["dj"], $myrow["entry"]);
      } while ($myrow = mysql_fetch_array($result));
    } else {
      // no records to display
      echo "Sorry, no records were found!";
    }
} ?> THANKS!!!!!!!!! tommy birchett http://www.broadcastatic.com

« previous php.db (#32948) next »