PHP/MySQL Date display format

Can someone help me out here. I am trying to format my date.
My MySQL is a "datetime". How ever I would like to display only the
month, day, year like so "Jan,15,2007"
Here is my current code, what should I add to make it do what
I want.
<?php echo $row_Recordset1['review_date']; ?>
Thanks

Try this:
<?php echo Date("M d, Y",
strtotime($row_Recordset1['review_date'])); ?>
Ken Ford
Adobe Community Expert
Fordwebs, LLC
http://www.fordwebs.com
"newhorizonhosting.com" <[email protected]>
wrote in message news:et7lf6$q8a$[email protected]..
> Can someone help me out here. I am trying to format my
date. My MySQL is a
> "datetime". How ever I would like to display only the
month, day, year like so
> "Jan,15,2007"
>
> Here is my current code, what should I add to make it do
what I want.
>
> <?php echo $row_Recordset1['review_date']; ?>
>
> Thanks
>

Similar Messages

  • PHP MySQL data display problem

    I am having trouble getting data to display on my web page.In Dreamweaver CS3, I created a new page.
    Selected PHP as the type.
    Saved it.
    Connected a database and created a recordset (all using Dreamweavers menus. I did not write any code).
    NOTE: The database is on a remote server.
    The TEST button displayed the records from the recordset with no problem.
    On the new page, I then typed some text.
    Then dragged some fields from the Bindings tab to the page.
    I saved it and then went to preview it in my browser.
    The page comes up completely blank. Not even the text shows.
    I then saved the page as an HTML page.
    When I preview this in my browser, the text shows, but the fields and data do not.
    I then tried creating a dynamic table (again, using the Dreamweaver menus.).
    A similar thing happens, ie. If I save it as an HTML, the text shows and the column labels and border shows, but no data.
    Nothing shows if I save it as a PHP file.
    I can view the data online using files created by PHPMagic, so I know the data is there and retrievable.
    It is just in pages created in Dreamweaver that don’t work.
    What am I doing wrong?

    My web server supports PHP. I can disply PHP pages created by other software packages, just not the Dreamweaver ones.
    Frank
    Date: Thu, 4 Jun 2009 19:04:03 -0600
    From: [email protected]
    To: [email protected]
    Subject: PHP MySQL data display problem
    To view php pages - or pages with PHP code in them - in a browser, the page must be served up by a Web server that supports PHP. You can set up a testing server on your local machine for this purpose. Look for WAMP (Windows), MAMP (Mac), or XXAMP for some easily installed packages.
    Mark A. Boyd
    Keep-On-Learnin'
    This message was processed and edited by Jive.
    It shall not be considered an accurate representation of my words.
    It might not even have been intended as a reply to your message.
    >

  • PHP/MySQL Date Format problems

    Dear all,
    In the past I successfully formatted a date from a Unix date format to my own desired output by using a PHP command as such:
    echo date($row_rsGNresults['date'], "Y F j"); 
    For a reason unbeknown to me, this no longer works and no matter what I try, the page always returns the date results in yyyy-mm-dd format.
    I've even tried using date format in the SQL query:
    SELECT * DATE_FORMAT('date', '%Y %F %j') AS showdate FROM gemnews_tab WHERE language LIKE %s AND entry LIKE %s AND works LIKE %s AND category LIKE %s ORDER BY date ASC 
    I've even tried installing various Dreamweaver extensions for date server formats (like Kaosweaver's) to no avail.  I've checked MySQL and the field is definitely set to 'date' and the dates are in yyyy-mm-dd format.
    Does anyone have any suggestions?  Would it matter that the dates are from the 18th century?
    Many Thanks
    J
    Message was edited by: Günter Schenk. Reason: the "PHP command" code was invisible

    Try this:
    <?php echo Date("M d, Y",
    strtotime($row_Recordset1['review_date'])); ?>
    Ken Ford
    Adobe Community Expert
    Fordwebs, LLC
    http://www.fordwebs.com
    "newhorizonhosting.com" <[email protected]>
    wrote in message news:et7lf6$q8a$[email protected]..
    > Can someone help me out here. I am trying to format my
    date. My MySQL is a
    > "datetime". How ever I would like to display only the
    month, day, year like so
    > "Jan,15,2007"
    >
    > Here is my current code, what should I add to make it do
    what I want.
    >
    > <?php echo $row_Recordset1['review_date']; ?>
    >
    > Thanks
    >

  • Data display Format issue.

    Hi ,
    I have the following columns for a single item(SingleVO),
    ItemNo, SugQty, OrdQty, Description,
    I would like to display the data in a table(Normal table or in a Advanced Table) with the
    following format. If there are 50 items, First row should display the First Item's
    itemno, sugqty, orgqty and the secondrow should display the description of the first item and third row should display the Second item's itemno, sugqty, orgqty and the fourthrow should display the description of the second item ....etc.
    Column Names:
    |-------------------------------------------------------|
    |Itemno |     SugQty     |     OrdQty     |     
    |-------------------------------------------------------|     
    |<---------Description--------------------------------> |
    |-------------------------------------------------------|
    Data:
    |-------------------------------------------------------|
    |12344 |     63 |     60     |     
    |-------------------------------------------------------|     
    |<---------Dulux Paint No2----------------------------> |
    |-------------------------------------------------------|
    |12345 | 98     |     100 |     
    |-------------------------------------------------------|     
    |<---------Table set ------------------------> |
    |-------------------------------------------------------|
    I tried with advanced table merging functionality, i couldn't get this type of display.
    Pointers are appreciated.
    (Since we are doing this application for Mobile devices we need to get this kind of display)
    Thanks.
    With Regards,
    Kali.
    OSSI.
    Format change.
    Message was edited by:
    Kalimuthu V
    Message was edited by:
    Kalimuthu V

    Thanks Ranjit,
    We build the table dynamically using rows and columns with the required spans.
    So that we could achieve the same display format.
    Thanks.
    With Regards,
    Kali.
    OSSI.

  • How To change the Date display format to dd.mm.yyyy format

    Hello friends
    I am expected to display the date fields in my BEx reports in the standard dd/mm/yy format. However, I find that it is getting displayed in mm/dd/yyyy form.
    This is creating a bit of a confusion for the client.
    Hence can someone please let me know, if I can make any change to the way the date is displayed in the reports.
    Looking for a prompt reply
    Thanks in advance
    regards
    Zubin Kurian

    Hi Zubin,
            There are some corrections in that coding.
    year = year+2(2).
    CONCATENATE day month year INTO l_date SEPERATED BY u2018/u2019.
    Regards,
    Yokesh.

  • PHP/mySQL data connection

    Hi,
    I've used DW CS3 to create a database connection to a mySQL
    database that I created in phpMyAdmin. When I do the setup and test
    all the connections, everything works - my table comes up, I'm able
    to select it. I created a recordset to display what's in the
    database. When I test the page, I'm getting this error:
    Warning: mysql_connect() [function.mysql-connect]: Access
    denied for user 'identity_teach'@'localhost' (using password: NO)
    in /home/identity/public_html/Connections/facultyDB.php on line 7
    Cannot connect to the database because: Access denied for
    user 'identity_teach'@'localhost' (using password: NO)
    The password info is in there - and I know it's right,
    because DW tests the connection and gives me a success message. Any
    ideas why I would be getting this error?
    Thanks!
    Carrie

    >in /home/identity/public_html/Connections/facultyDB.php
    on line 7
    Check your path in your code on line 7
    I had this same problem and it showed something like this
    (assuming you are using PHP)
    <?php virtual (/Connections/connbay.php'); ?>
    i changed to
    <?php require_once('../Connections/connbay.php'); ?>
    and it worked fine

  • Date display format

    I've built my first SharePoint app with Visual Studio using an Azure SQL database.
    The app is for the UK and all date fields are in the dd-mm-yyyy format.
    No problems with the date fields during development except that, when querying the database within the Azure management portal, date fields are displayed in the mm-dd-yyyy format.  Otherwise, whilst running the app on the local IIS all date fields
    are entered and displayed in the dd-mm-yyyy format without any problems.
    I have now deployed the app to Azure Websites.  Works fine except all the dates are displayed in the mm-dd-yyyy format.  To add or update a date, my code requires the dd-mm-yyyy format, which then produces an error.
    Your help would be much appreciated.  Apologies in advance if I have posted this to the wrong forum.
    Thanking you in anticipation.
    Roger 
    rogerwithnell

    Hi,
    If the only concern is about the date format then you can do the conversion in different format through CONVERT() fun too in Sql. If you want to do the changes on code or application level then you need to use String function to do the changes.
    Regards,
    Mukesh
    egards,

  • Dreamweaver php mysql date

    I have created a database in mysql 5 and I have also created
    a basic input record form. I am using Dreamweaver to create web
    pages, but I am having a little trouble with the date function.
    I am trying to figure out how to have "todays date"
    automatically input into the mysql database without user input in
    that field. Can anyone help?

    Sorry that it took me so long to respond top your post, but I
    have been trying a lot of things out.
    First off, I understand exactly what you were saying and it
    works on one page, but not on another. Here's the deal:
    the page that it works on is a project input page where the
    code is pretty much what you have already showed me. It works
    perfectly using the NOW()
    The other page is an update page, but the update code is
    writen differently, for example:
    UPDATE table SET field1=%s, field2=%s
    and in this script, the NOW() does not work.
    I want the date to be auto input into a different field and
    also I want the value "Y" to be input into another field once the
    update record buton has been pressed

  • Default date should be displayed in Locale's date short format in Prompt

    Dear BI Gurus,
    I would like to take your attention to resolve one of date format issue which we are currently facing.
    We want to display Current_Date in locale's date short format ( For US: MM/DD/YYYY and for UK: DD/MM/YYYY) in a dashboard prompt. Also we need to pass the the prompt value to the report filter through presentation variable.
    For this we used logical sql to get the default value as select Times.time_id from sh when times.time_id= Current_Date. Once I click on the preview button it was showing in locale's date short format. But when we place the prmpt in dashboard, the default date was coming up in 'YYYY-MM-DD' format. But since calendar picker is giving value in locale's date short format (For US: MM/DD/YYYY and for UK: DD/MM/YYYY), there is an inconsistency in the display format. So could you please provide any workaround to make them consistent.
    Thnaks,
    Siva Naga Hari.
    Edited by: user6371352 on 27-Mar-2010 13:50

    Hi Vinay,
    Thanks for reply.
    We are looking for default date display format in dashboard prompt. i.e For US locale, default date and calendar picker should be displayed in MM/DD/YYYY and for UK locale, default and Calendar picker should be displayed in DD/MM/YYYY.
    We don't have any problem in report output for different locales. Also we don't need to create 2 seperate reports for different locales. If we set the data format to [FMT:dateShort], it will display as per the locale's date short format. Please provide workaround to display in dashboard prompt.
    Thanks,
    Siva Naga Hari.

  • Need Advice! MySQL Field Type and data display

    DW8/PHP/MySQL
    This is a two part question.
    First off I am builing a database (mySQL) driven review site
    with PHP. I am working on creating my database, however I would
    like some input/advice from others. Below are some example fields
    that will be in my database. Can anyone give me advice on what
    field type I should use on each
    Name
    Address_1
    Address_2
    City
    State
    Zip
    Phone
    Web_Address
    Email_Address
    Date_Reviewed
    Review_Description
    Username
    Password
    My second question.
    I made a simular test site using Dreamweaver and got it to
    work ok. However the formating on my description did not look
    correct. On my input page I used a large multi-line form box. When
    I hit enter to divide the paragraphs it looked fine in the iput
    box, but once the same data was pulled from the database the
    paragraphs where all ran together in one large text block. What do
    I need to do to keep my input formating?
    Thanks in advance for any help
    Charles

    newhorizonhosting.com wrote:
    > Can anyone dive me advice on what
    > field type I should use on each/
    >
    The following ones should all be VARCHAR. Set the length of
    each one so
    that it easily accommodates the longest likely entry.
    Name
    Address 1
    Address 2
    City
    State
    Zip
    Phone
    Web Address
    Email Address
    Date Reviewed - DATE
    Review/Description - TEXT
    Username - VARCHAR
    Password - VARCHAR (length needs to be 40 if you encrypt)
    > once the same data was pulled from the database the
    paragraphs where
    > all ran together in one large text block. What do I need
    to do to keep my input
    > formating?
    When displaying the text, pass the variable that contains it
    to nl2br().
    echo nl2br($row_recordsetName['myParagraphs']);
    David Powers, Adobe Community Expert
    Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
    Author, "PHP Solutions" (friends of ED)
    http://foundationphp.com/

  • Php mysql math error when using format(somenumber,2)

    osx 10.5.2, php 5.2.5, mysql 5.0.51 (standard leopard desktop os install)
    Select format(myField,2) as someNumber from myTable ...
    returns data i would expect, formatted as you would expect.
    while looping through the data returned i am calculating a running total.
    for numeric values less than 1,000 results are expected. for numbers gt 1000, php seems to want to truncate the value at the comma. 1,111.11 evaluates to 1; 25,000 evaluates to 25.
    If you remove the format() from the sql statement everything works the way you would expect.
    wrapping the value returned in a floatval() had no effect.
    I am posting this on the apple site rather than php/mysql forums on the off chance that this is a mac centric issue. googling the obvious combinations wasn't productive.

    Sounds like a locale issue.
    Many international formats use comma as the decimal separator, not the thousands.
    There are many levels where this could be set. It could be an OS setting (you don't say where you or, or the locale information of your machine (System Preferences -> International -> Format). It could be in PHP (see: http://www.php.net/setlocale ), or it could be in the database (data could be written in a comma-based table).
    It will take a little research to work out where your specific problem lies.

  • Best way to retrieve/store date Flex PHP MySQL?

    Hi All,
    I have a question about storing/retrieving a date-field from the MySQL database, using Flash Builder 2 & Zend AMF.
    This is as much as I know:
    MySQL Database stores date in this format: yyyy-mm-dd hh:mm:ss
    And Flex will not recognise that as a "date", instead it will suggest this value is an "object".
    With "Configure return type", I can manually set this field to "date", but it will not work retrieving of updating the date as MySQL will not understand the standard date-format it'll receive,
    I guess, the best solution would be if I could tell the MySQL Server how the standard date-format should be, but I have not found this option. Can anyone confirm this?
    The remaining options are:
    Format the date in the SQL-query
    Format the date in the PHP-function sending/retrieving
    Format the date in Flex, befor assigning it to a date-field...
    Can someone tell me the BEST practice to handle date-objects? I guess it's the date_format function in MySQL....
    I'm trying to build an app with over 3200 fields, shared over 60 tables, of which many are date-fields.
    Would be awesome if I could just use SELECT * FROM myTable, and all would be fine with date-fields and all...
    Any tips?

    I'm confused. This is what I have:
    On my MySQL database, I've created a VIEW with the query that I need. I thought it'd generally be efficient to create views for every 'Form' that I need.
    This is my VIEW v_person
    SELECT p.`person_id`, p.`name`, p.`lastname`, DATE_FORMAT(p.`birthdate`,'%d/%m/%Y %r') as birthdate
    FROM person p
    Now I have a simple table v_person returning
    person_id
    name
    lastname
    birthdate
    0
    John
    Doe
    null
    1
    Jane
    Did
    23/08/1976 12:00:00 AM
    2
    Juno
    Doh
    01/04/2001 12:00:00 AM
    "Great! Now I can set up my query once, returning the date in whatever format Flex likes."
    Not.
    This is the standard generated PHP function to get information by ID. This works fine.
         public function getV_personByID($itemID) {
              $stmt = mysqli_prepare($this->connection, "SELECT * FROM $this->tablename where person_id=?");
              $this->throwExceptionOnError();
              mysqli_bind_param($stmt, 'i', $itemID);          
              $this->throwExceptionOnError();
              mysqli_stmt_execute($stmt);
              $this->throwExceptionOnError();
              mysqli_stmt_bind_result($stmt, $row->person_id, $row->name, $row->lastname, $row->birthdate);
              if(mysqli_stmt_fetch($stmt)) {
                   return $row;
              } else {
                   return null;
    This is the standard generated Form in Flex:
    One note to make when using RETURN TYPE,
    is that in when I use person_id=0 , I can change "birthdate type" from OBJECT to DATE, because date is null.
    When I use person_id=1 , I CAN'T change "birthdate type" as it defaults to "STRING".
    Since I want to use a dateField in my Form, I changed birthdate type to "DATE". (Even though I now understand that return type IS in fact a string)
    <fx:Script>
         <![CDATA[
              import mx.controls.Alert;
              import mx.formatters.DateFormatter;
                   protected function button_clickHandler(event:MouseEvent):void
                   getV_persontestByIDResult.token = vpersontestService.getV_persontestByID(parseInt(itemIDTextInput.text));
         ]]>
    </fx:Script>
    <fx:Declarations>
              <vpersontestservice:VpersontestService id="vpersontestService" fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)" showBusyCursor="true"/>
         <s:CallResponder id="getV_persontestByIDResult" result="v_persontest = getV_persontestByIDResult.lastResult as V_persontest"/>
         <valueObjects:V_persontest id="v_persontest" person_id="{parseInt(person_idTextInput.text)}" />
         <!-- Place non-visual elements (e.g., services, value objects) here -->
    </fx:Declarations>
    <mx:Form defaultButton="{button}">
         <mx:FormItem label="ItemID">
              <s:TextInput id="itemIDTextInput"/>
         </mx:FormItem>
         <s:Button label="GetV_persontestByID" id="button" click="button_clickHandler(event)"/>
    </mx:Form>
    <mx:Form>
         <mx:FormHeading label="V_persontest"/>
         <mx:FormItem label="Birtdate">
              <mx:DateField id="birthdateDateField" selectedDate="@{v_persontest.birthdate}" />
         </mx:FormItem>
         <mx:FormItem label="Last name">
              <s:TextInput id="lastnameTextInput" text="@{v_persontest.lastname}"/>
         </mx:FormItem>
         <mx:FormItem label="First name">
              <s:TextInput id="nameTextInput" text="@{v_persontest.name}"/>
         </mx:FormItem>
         <mx:FormItem label="person_id">
              <s:TextInput id="person_idTextInput" text="{v_persontest.person_id}"/>
         </mx:FormItem>
    </mx:Form>
    Works great! Except that it can't handle the date field:
    TypeError: Error #1034: Type Coercion failed: cannot convert "10/21/1984 12:00:00 AM" to Date.
         at com.adobe.serializers.utility::TypeUtility$/assignProperty()[C:\perforceGAURAVP01\depot\flex\ide_builder\com.adobe.flexbuilder.dcrad\serializers\src\com\adobe\serializers\utility\TypeUtility.as:534]
         at com.adobe.serializers.utility::TypeUtility$/convertToStrongType()[C:\perforceGAURAVP01\depot\flex\ide_builder\com.adobe.flexbuilder.dcrad\serializers\src\com\adobe\serializers\utility\TypeUtility.as:497]
         at com.adobe.serializers.utility::TypeUtility$/convertResultHandler()[C:\perforceGAURAVP01\depot\flex\ide_builder\com.adobe.flexbuilder.dcrad\serializers\src\com\adobe\serializers\utility\TypeUtility.as:371]
         at mx.rpc.remoting::Operation/http://www.adobe.com/2006/flex/mx/internal::processResult()[E:\dev\trunk\frameworks\projects\rpc\src\mx\rpc\remoting\Operation.as:316]
         at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::resultHandler()[E:\dev\trunk\frameworks\projects\rpc\src\mx\rpc\AbstractInvoker.as:313]
         at mx.rpc::Responder/result()[E:\dev\trunk\frameworks\projects\rpc\src\mx\rpc\Responder.as:56]
         at mx.rpc::AsyncRequest/acknowledge()[E:\dev\trunk\frameworks\projects\rpc\src\mx\rpc\AsyncRequest.as:84]
         at NetConnectionMessageResponder/resultHandler()[E:\dev\trunk\frameworks\projects\rpc\src\mx\messaging\channels\NetConnectionChannel.as:547]
         at mx.messaging::MessageResponder/result()[E:\dev\trunk\frameworks\projects\rpc\src\mx\messaging\MessageResponder.as:235]
    Somehow SOMETHING wants to convert "10/21/1984 12:00:00 AM" to Date.
    Where does it fail? I feel like I'm SO close, but making a faceplant right before the finish.
    ok.
    I'm by no means an expert, so let me know if I'm doing something wrong, but this is how I'd expect it to work.
    Can someone tell me how I should use a dateField instead? Where should I make the stringToDate and dateToString conversion?

  • MySQL date fomat with PHP

    I have a problem with format date stored in mySql db ( in the
    fied named 'dt_news') as dd-mm-yyyy.
    Now when I view my php page where I show all the records, I
    have the following type yyyy/mm/dd.
    Please help me to modify the attached code an have that
    result.

    Add to your code
    <?php
    function mysql2date($date){
    $temp = explode("-",$date);
    $newdate = $temp[2] . "/" . $temp[1] . "/" . $temp[0];
    return $newdate;
    Then instead of:
    <?php echo $row_View_News['dt_news']; ?>
    Use:
    <?php echo mysql2date($row_View_News['dt_news']); ?>
    This will change the mysql date format from YYYY-MM-DD to
    DD/MM/YYYY
    Gareth
    http://www.phploginsuite.co.uk/
    PHP Login Suite V2 - 34 Server Behaviors to build a complete
    Login system.

  • Date and number display format

    Hello all,
    I am new to Adobe Form, and I am quite unimpressed with how difficult it is to do the most simple things.
    I have managed one way or another to solve all my problems until now, but this one got me stuck.
    I have date and number fields in my form, and here is what I want to do but cannot:
    - I need these fields to be displayed using the defaults date and number settings of the SAP user who is generating the form. This one is really hard for me to figure out.
    - I need some other fields to be displayed in a specific format depending on a variable in the context of my form. I imagine this could be done using scripting, but how to change the display format of a field via scripting?
    Anyone has an idea of how that can be achieved?
    Thank you.

    Hi Thomas,
    For these kind of issues you will get many answers if you search the forum.
    If your requirement is to display the current date in the form, just drag and drop the "Current date" UI element from the Library palette -> Custom.
    If it is to get the date from SAP and display, pass date to the context node and just drag and drop the field into the form from the data view.
    Check the following wiki by Chintan. It explains some common scenarios in javascript.
    [JavaScript Part 1|http://wiki.sdn.sap.com/wiki/display/ABAP/JavaScriptforCommonScenarios-PartI]
    [JavaScript Part 2|http://wiki.sdn.sap.com/wiki/display/ABAP/JavaScriptforCommonScenarios-PartII]
    Use an 'if' condition, check the value and based on the value you can make the field hide/visible in the form.
    Hope this will help.
    Thanks & Regards,
    Sanoosh

  • Spry accordion with php mysql as data

    Hello
    I`m trying to create a spry accordion where the Labels are pulled from a mysql database table and the Content of that label is pulled from data in the same database. I tried adding first the spry accordion and then created 1 recordset for the labels and a second recordset for the content , then I added a repeat region for the labels DIV and inside this div I added a repeat region for the content.
    Unfortunatly when viewed in the browsers the accordion doesn`t work.
    Can anyone look at the code and tell me where is the mistake.
    Thanks
    <?php require_once('Connections/log.php'); ?>
    <?php
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
      if (PHP_VERSION < 6) {
        $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
      $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
      switch ($theType) {
        case "text":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;   
        case "long":
        case "int":
          $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case "double":
          $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
          break;
        case "date":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
        case "defined":
          $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
          break;
      return $theValue;
    mysql_select_db($database_log, $log);
    $query_log_year = "SELECT DISTINCT Year(`23849`.acoff) AS yy FROM `23849` ORDER BY Year(`23849`.acoff)";
    $log_year = mysql_query($query_log_year, $log) or die(mysql_error());
    $row_log_year = mysql_fetch_assoc($log_year);
    $totalRows_log_year = mysql_num_rows($log_year);mysql_select_db($database_log, $log);
    $query_log_year = "SELECT DISTINCT Year(`23849`.acoff) AS yy FROM `23849` ORDER BY Year(`23849`.acoff)";
    $log_year = mysql_query($query_log_year, $log) or die(mysql_error());
    $row_log_year = mysql_fetch_assoc($log_year);
    $totalRows_log_year = mysql_num_rows($log_year);
    $mhour_log_mon = "0";
    if (isset($row_log_year['yy'])) {
      $mhour_log_mon = $row_log_year['yy'];
    mysql_select_db($database_log, $log);
    $query_log_mon = sprintf("SELECT DISTINCT DATE_FORMAT(`23849`.acoff, '%%M') AS mon , DATE_FORMAT(`23849`.acoff, '%%m') AS m , sum(`23849`.ablock) as toth FROM `23849` WHERE YEAR(`23849`.acoff) = %s GROUP BY m ORDER BY m ", GetSQLValueString($mhour_log_mon, "int"));
    $log_mon = mysql_query($query_log_mon, $log) or die(mysql_error());
    $row_log_mon = mysql_fetch_assoc($log_mon);
    $totalRows_log_mon = mysql_num_rows($log_mon);
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>testing ajax php mysql</title>
    <script src="SpryAssets/SpryAccordion.js" type="text/javascript"></script>
    <link href="SpryAssets/SpryAccordion.css" rel="stylesheet" type="text/css" />
    </head>
    <body>
    <div id="Accordion1" class="Accordion" tabindex="0">
      <div class="AccordionPanel">
        <?php do { ?>
          <div class="AccordionPanelTab"><?php echo $row_log_year['yy']; ?></div>
          <?php } while ($row_log_year = mysql_fetch_assoc($log_year)); ?>
    <div class="AccordionPanelContent">
      <table width="100%" border="0" cellspacing="5" cellpadding="5">
        <?php do { ?>
          <tr>
            <td><?php echo $row_log_mon['mon']; ?></td>
            <td><?php echo $row_log_mon['toth']; ?></td>
          </tr>
          <?php } while ($row_log_mon = mysql_fetch_assoc($log_mon)); ?>
      </table>
    </div>
      </div>
    </div>
    <script type="text/javascript">
    <!--
    var Accordion1 = new Spry.Widget.Accordion("Accordion1");
    //-->
    </script>
    </body>
    </html>
    <?php
    mysql_free_result($log_year);
    mysql_free_result($log_mon);
    ?>

    You only have 1 "AccordianPanel" which contains a list of "AccordianPanelTab" elements, then a list of "AccordianPanelContent" elements.
    You need to have a list of "AccordianPanel" elements, each containing a pair or "AccordianPanelTab" and "AccordianPanelContent" elements.
    HTH,
    Randy

Maybe you are looking for