High decomposition problem: PHP query MySQL data, recordset how special display

Source: Internet
Author: User
High decomposition puzzle: PHP query MySQL data, recordset how special display!
MYSQL has a commodity price table,


Query a product in PHP, displayed on the page, the query results are as follows:




The difficulty is how to display by year and month! The hard-to-die brother, Kneel beg operation statement!

------Solution--------------------
PHP Code
.... $result =mysql_query ("Select year (addtime) as Y,group_concat (jiage) as STR from the TABLE_NAME GROUP by Year" ( Addtime); "); while ($row =mysql_fetch_assoc ($result)) {      echo ';      echo "$row [y]";      foreach (Explode (', ', $row [str]) as $v)            echo "$V;      Echo ';} ............
------Solution--------------------
$result =mysql_query ("Select year (add_date) as Y,group_concat (yc_jiage) as Str from Jiagedata Group by year (Add_date);") O R Die (Mysql_error ());

Post a hint.
------Solution--------------------
What information is prompted after executing the #12 building.
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.