How To Group Mysql Results In A List

free web hosting
Open Discussion > CONTRIBUTE > Computers > Programming Languages > PHP Programming

How To Group Mysql Results In A List

alexviii
Ok so I have an array that I would like to group by date. When I use the group by in a mysql query it only shows one record with that value. However I want to show all the records grouped by date. This is what I have so far.

CODE
$completedprojectsresults=mysql_query("SELECT request_tbl.*, DATE_FORMAT(SubmittalDate, '%b %d, %Y') cdate ,   s.*
FROM  
request_tbl , site_tbl AS s
WHERE
request_tbl.Site_ID = s.Site_ID
AND
request_tbl.Date_Completed >= STR_TO_DATE('$from', '%m-%d-%Y')
AND
request_tbl.Date_Completed <= STR_TO_DATE('$to', '%m-%d-%Y')
Group BY
request_tbl.Request_ID
ORDER BY
cdate,
s.FullSiteName");    

while($cprow=mysql_fetch_assoc($completedprojectsresults)){

echo "<dl>";
echo "Completed on  ";
echo $cprow['cdate'];
echo "<li>";
echo $cprow['SiteLookup'];

echo "</li></dl>";

}  
10x

 

 

 


Reply

beeseven
Why don't you put everything into an array? Actually....

You could choose some random date before the while loop and assign it to a variable, say $date. At the beginning of the loop, check if the date of the next project is the same as $date. If it is, just display the project name. If it isn't, display the new date and change $date to the new date.

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.

Recent Queries:-
  1. mysql counter group-by - 515.76 hr back. (1)
Similar Topics

Keywords : group, mysql, results, list

  1. Running A Live Group
    Are there any other Live Group Leaders about? (0)
  2. Telemarketing Block List - Canada
    DO NOT CALL List coming to Canada (1)
    Link: http://www.lnnte-dncl.gc.ca/index-eng.html FINALLY!!! Something good from the
    Government in Canada... Effective Sept 30th, 2008, you will be able to place your phone number on a
    Block list for telemarketers. Fact Sheet here: http://www.crtc.gc.ca/eng/dncl_info.htm#tel CRTC
    Decision information here: http://www.crtc.gc.ca/archive/eng/decision...7/dt2007-48.htm Now you
    can relax and enjoy your supper without those bothersome interruptions. /biggrin.gif"
    style="vertical-align:middle" emoid=":D" border="0" alt="biggrin.gif" /> No telling how ef....
  3. Mysql Hacks
    (1)
    There are MySQL hacks out there, They can travel from your website to your computers. One of these
    are the MySQL injectors. The injection drops your tables and shuts down the program permanently. Be
    careful of these hacks, as they can destroy your MySQL related websites, programs, etc.....
  4. Creating A Shortcut List Near The System Tray
    Time saver tip for windows (4)
    Are you bored at work today? Here's a small enhancement to your desktop. Hope you like it. I)
    When you have to open any program you have to click "Start" "All Programs" and then choose your
    selection from the programs folder. Now how would it be to achieve the same task in just two clicks?
    You can save all your favourite program shortcuts in a folder and view that through a tiny arrow
    near the system tray. Its very simple. You would tell, "Ya, I almost knew that". Here's how to
    do it. a) First create your folder and add the shortcuts you want to access. The f....
  5. How To Use A Database For Chess Results?
    How to set-up, configure, and utilize a database to store chess result (0)
    Hi, I'm running a website for our chess club. Recently we decided to add a feature for members
    to simply enter their tourney results there but I do not exactly know how to do it. The first
    problem is how to create form for people to enter their game results. I just have an idea that
    working with drop down menus is faster, esaier and more precise than typing the information. The
    second problem is how to make these results search-able? Let me tell you the final problem which is
    the worst of all that is I do not know how to build a member area. Because Qupis does no....
  6. Creating A Php Login System Using Mysql
    I need help in creating a login system, what I want is a login system (10)
    Hey everyone! I am helping someone make a login system using MySQL databases and a PHP login
    form. I have a fair bit of experiance in HTML and some javascript too. I have virtually no
    experiance in MySQL or PHP. Anybody know of any good PHP login systems that allow you to creat a
    personalised page for each user and when they login the system transfers the user to their page.
    Another thing that the system MUST have is a way of stopping unwanted users entering someones page.
    CODE For example lets say I register and my UN is jesse123 and my personalised pages a....
  7. Mysql Database Not Working
    (3)
    well i'm getting an error message(a databass connection warning) for all of the parts of my site
    that connects to a mysql database i check my database users pertmissions and i try to do the repair
    database thing and it's still not woeking. am i the only person having this or is it an overall
    trap17 issue and how do i fix it.....
  8. The Only Reason I Choose Ms Sql Server Rather Than Mysql
    (0)
    The only reason i choose ms sql server rather than mysql is, MS SQL has more security
    features!! MySQL is lacking a lot in my opinions - Lack in wide char, like nvarchar, I
    developed some application to support chinese letter, and dont know how to build one in mysql - Lack
    in t-sql syntax, like query in query is not fully supported - Does not have today SQL features like
    BI support (today really required) And compare MS SQL to MySQL, the only reason why mysql is
    favourable is - it is free! Dont u guys agree?....
  9. Good Freeware List
    (6)
    Here is the list of my computer freeware - Free Download Manager (manages your download, very
    reliable) - Moyea FLV Downloader (you can download FLV files form ANY sites!! Not only
    youtubes) - AVG 7.5 (free anti virus) - Audacity (free tools for audio, we can cut or paste and
    adjust audio files) - OpenOffice (free office application) - Vista Transformation Pack (create vista
    style in windows xp desktop) All freeware are greats....
  10. Hackers Rob Best Western Hotel Group, Steal 8m Guest Records
    (1)
    I thought I toss out this security alert especially if you have been staying at one of their hotels
    in the last 12 months and that you find out which credit card or debit card you use and get that one
    cancel ASAP. Of course now reports are say that this Indian noob hacker got a small portion of
    information and as for the Russian mafia not to sure if that is true or not. Either way I suggest
    that if you stayed at a Best Western in the last year and see if your name comes up at all. So the
    question is who is tell the truth that 8 million records where stolen and sold off....
  11. Need Advice On Setting Up Mysql Database.
    I have a huge amount of daily data updates to be inserted. (4)
    First of all, to get the idea of what I am trying to achieve here, please have a look at my
    idea thread, entitled Idea For Using A Cron Job To Grab Daily Travian Map.sql Updates . This gives
    a prelude to the project, what it is for, what it is supposed to do, etc. Now, what I need is
    specific advice on setting up the mySQL database(s) to implement this idea. There is a useful FAQ
    file for how to make use of the map.sql data located on the help.travian.com website, which also
    gives an example of the CREATE TABLE instruction that matches the data in the map.sql fi....
  12. Mysql Db Is Down Getting Following Error
    (2)
    My Mysql is Down can I get some help please? Appreciate it. Patrick Domain: patrickcurl.com Error:
    phpMyAdmin - Error #2002 - The server is not responding (or the local MySQL server's socket is
    not correctly configured)....
  13. Mmorpg Group Plays 18 Hour Straight
    A group of dedicated players tried to bring down a boss in an MMORPG.. (5)
    A group of dedicated players tried to bring down a boss in an MMORPG Final Fantasy XI's
    Pandemonium Warden but failed. Source :
    http://www.techtree.com/India/News/MMORPG_...-92146-585.html This would be an interesting read
    but its too short. For many years in MMORPG, i would say FFXI really made a genuine record for
    longest gameplay.....
  14. Top 10 Geek Ways To Beat Boredom
    My list. What's yours? (12)
    My Top Ten recommendations for what geeks can do to stop getting bored... 1. Visit a humorous
    website. My recommendation: Computer Stupidities - http://www.rinkworks.com/stupid/ 2. Download
    a new computer game Linux: http://www.happypenguin.org Windows / DOS: http://www.pcgaming.ws
    Mac: http://www.macgamesandmore.com/best_freeware.html For the record, my geek-game recommendation
    would be nethack: http://www.nethack.org 3. Build something in 3D For this I recommend Blender.
    It's a big program to learn, but well worth it. Download from: http://www.b....
  15. List Of Free Games
    (With Descriptions) (10)
    Ok, so I was told that the other list of games was no good because it was just a list. I am going to
    start a list now that will include the descriptions so the posts will have substance. This list can
    be added to by everyone, but let's use this format: Name: Website: Type: (FPS, RPG, RTS
    etc.) Players: (Single- or Multi-Player) Description: Here are a couple that I am playing now:
    Name: Combat Arms Website: http://combatarms.nexon.net Type: First-Person Shooter Players:
    (Massively) Multi-Player Description: This game is a lot like Soldier Front....
  16. It Went Well For A While
    MySQL problem back in all its glory. (5)
    Some time ago I had a stubborn problem when trying to access one of the interactive pages on my
    website and getting the following error: QUOTE Warning: fopen() : open_basedir restriction in
    effect. File(include/errors.xml) is not within the allowed path(s):
    (/home/mrdee:/usr/lib/php:/usr/local/lib/php:/tmp) in
    /home/mrdee/public_html/admin/include/commonfunctions.php on line 682 Warning:
    fopen(include/errors.xml) : failed to open stream: Operation not permitted in
    /home/mrdee/public_html/admin/include/commonfunctions.php on line 682 Cannot open XML data file:
    incl....
  17. Ameran Portals?
    A list is needed! (1)
    Listen. guys! Could you post American portals or forums, I really need it! List as much you
    can, but keep in mind I need those portals or forums which contain topics such as movies, music, and
    so on. Waiting for you reply.....
  18. The Coding Group
    (23)
    I'm sure by now everybody knows the evil group, and I've been waiting for somebody to make a
    rival group to it and perhaps we could have a group battle. I was going to start one myself but I
    didn't feel it appropriate being in both groups rival to each other so to inspire people to make
    their own "groups" I created a neutral one. The coding group. The members and their tag lines are
    as follows: QUOTE OpaQue (CrYpToLoGiC, MaDScIenTIsT, l33t Programmer) , galexcd
    (Evil Programmer) , truefusion (Analyst Programmer) , ....
  19. Data Structures -- Linked List -- Reverse
    Reverse a linked list (5)
    Give an algorithm to reverse a linked list with a time complexity of O(n) and minimal space
    complexity. What is a linked list? Search trap17.com. i Have already answered this question in
    one of my older questions. Solution 1 Here is one simple solution... CODE Void
    ReverseList(node* head) {     node *temp,*current,*result;     temp=null;     result=null;
        current=head;     while(current!=null)     {         temp=current->next;
            current->next=result;         result=current;         current=temp;     }   
    head=result; ....
  20. Data Structures -- Linked List
    Find the nth last element in linked list. (9)
    Given a linked list, find the 5th last element with Time complexity O(n) and minimal space
    complexity. Note: If you know the answer and if you feel it is simple also please post the
    answers so that others will come to know about the answers. What is a linked list?? /* this is for
    your further reference and reading */ QUOTE In computer science, a linked list is one of the
    fundamental data structures, and can be used to implement other data structures. It consists of a
    sequence of nodes, each containing arbitrary data fields and one or two references ("links") po....
  21. Free Sms Site
    List of free SMS sites (5)
    I start this topic for us to post free sms working site. If anyone of us have a free sms site that
    works, don't hesitate to post it here! Thank to all of you to participate. /wink.gif"
    style="vertical-align:middle" emoid=";)" border="0" alt="wink.gif" /> EDIT--- Kindly give
    description about the SMS site, if possible :-)....
  22. A List Of Great Movies!
    (162)
    Ok, muy favorite movies are: Butterfly Effect Pirates of the Caribbean (The curse of the Black
    Pearl) Titan AE....
  23. Quick Question
    Is there a limit on the size of the MySQL database? (10)
    Question's in the title!....
  24. Subquery In Mysql
    (5)
    Is there anyway to make subqueries work in MySQL? I'm pretty certain someone out there knows
    how. /smile.gif' border='0' style='vertical-align:middle' alt='smile.gif' /> Can anyone help?
    CODE Select * from ITEMS where ID="Select Max(ID) from ORDERS"; This works
    for MSAccess and SQL Server but why not in MySQL? I'll be writing some reports and I've
    shifted database from MSAccess to MySQL. Help! Thanks.....
  25. Mysql Database Size
    related to the free database space (7)
    hi all! this is my first post /biggrin.gif' border='0' style='vertical-align:middle'
    alt='biggrin.gif' /> and i have a doubt, how much mysql space i am allowed to use... i mean how
    much is available for my free account....
  26. Import From Excel File Into Mysql Database
    (11)
    Has anyone tried using the excel import function that comes with phpmyadmin
    http://www.phpmyadmin.net/home_page/ - it does not require any additional plug-ins or scripts and
    is fairly straightforward to use. In phpmyadmin, if you click on the database table which you wish
    to import the data to , there is a link on the bottom left corner which says "insert data from a
    text file into the table" - although it says text file it still can be used to import an excel file.
    When you click on this link you will be taken to a page where you will be asked for the file name
    (the....
  27. Increment A Mysql Column
    how to increment a MySQL column one unit (7)
    Hi, I have a column in a MySQL table which contains a counter of the views of the object described
    by this table. I would like to increment this value by one everytime the object is viewed. Obviously
    came into my mind the possibility of retrieving the value of this field, store it in a variable
    increment this value by one and perform an UPDATE query again with this new value. My question is if
    there is a MySQL option to update the field with its actual value plus an unit increment. I hope you
    understand the issue.....
  28. Free Classified Ads--no Hype
    Regional ads with photos at Craig's List (6)
    Craig's List has been around forever and it just keeps getting better. There's no hype, no
    popups, no banners, just legitimate ads with photos that really pull. Our son sold 2 items over
    there last month. You have to renew them or they fall off and it's best to cancel and re-list
    your stuff, weekly, to stay near the top. /smile.gif' border='0' style='vertical-align:middle'
    alt='smile.gif' /> Craig's List ....
  29. Complete Login System
    With PHP + MYSQL (57)
    Its an complete login sistem made and tested by me and I think itwill be very usefull for people who
    are tryn to learn PHP. First, let's make register.php: CODE <?
    include("conn.php"); // create a file with all the database connections
    if($do_register){ // if the submit button were clicked if((!$name)
    || (!$email) || (!$age) || (!$login) ||
    (!$password) || (!$password2)){ print "You can't let
    any fields in blank....
  30. Mysql Database Setup : Setting Up Mysql Database
    Guide to use MySQL database in your site (6)
    A SMALL INTRODUCTION TO DATABASE ============================= I have seen that many members have
    problems with Database. Here is a small INFO which should give you the IDEA. mySQL is a DATABASE
    server. You can access it using the link in Cpanel. Cpanel can be accessed by
    "www.YOUR-SITE.com/Cpanel" There you have 4 Main Options :- 1> CREATE A DATABASE 2> CREATE A USER
    3> ADD USER TO DATABASE 4> PHPMYADMIN CREATE : IT ALLOWS YOU TO CREATE A DATABASE CREATE USER
    : IT ALLOWS YOU TO CREATE A USER. USING THIS, YOU CAN ACCESS THE DATABASE. A DATABASE CANNOT BE....

    1. Looking for group, mysql, results, list

*RANDOM STUFF*





*SIMILAR VIDEOS*
Searching Video's for group, mysql, results, list

*MORE FROM TRAP17.COM*
Similar
Running A Live Group - Are there any other Live Group Leaders about?
Telemarketing Block List - Canada - DO NOT CALL List coming to Canada
Mysql Hacks
Creating A Shortcut List Near The System Tray - Time saver tip for windows
How To Use A Database For Chess Results? - How to set-up, configure, and utilize a database to store chess result
Creating A Php Login System Using Mysql - I need help in creating a login system, what I want is a login system
Mysql Database Not Working
The Only Reason I Choose Ms Sql Server Rather Than Mysql
Good Freeware List
Hackers Rob Best Western Hotel Group, Steal 8m Guest Records
Need Advice On Setting Up Mysql Database. - I have a huge amount of daily data updates to be inserted.
Mysql Db Is Down Getting Following Error
Mmorpg Group Plays 18 Hour Straight - A group of dedicated players tried to bring down a boss in an MMORPG..
Top 10 Geek Ways To Beat Boredom - My list. What's yours?
List Of Free Games - (With Descriptions)
It Went Well For A While - MySQL problem back in all its glory.
Ameran Portals? - A list is needed!
The Coding Group
Data Structures -- Linked List -- Reverse - Reverse a linked list
Data Structures -- Linked List - Find the nth last element in linked list.
Free Sms Site - List of free SMS sites
A List Of Great Movies!
Quick Question - Is there a limit on the size of the MySQL database?
Subquery In Mysql
Mysql Database Size - related to the free database space
Import From Excel File Into Mysql Database
Increment A Mysql Column - how to increment a MySQL column one unit
Free Classified Ads--no Hype - Regional ads with photos at Craig's List
Complete Login System - With PHP + MYSQL
Mysql Database Setup : Setting Up Mysql Database - Guide to use MySQL database in your site
advertisement



How To Group Mysql Results In A List



 

 

 

 

ADD REPLY / Got an Opinion! a humble request :-) RAPID SEARCH! Free Hosting [X]
Express your Opinions, Thoughts or Contribute your information that might help someone here.
Ask your Doubts & Queries to get answers.. "Together, We enlight each other!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE