Jul 20, 2008

How To Group Mysql Results In A List

Free Web Hosting, No Ads > CONTRIBUTE > Computers > Programming Languages > PHP Programming

free web hosting

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.
Confirm Code:

Similar Topics

Keywords : group, mysql, results, list

  1. Database Or Pdf
    Best way to list books on my site (1)
  2. Recommended List Of Money Making Sites
    A list of 10 sites from which easy money can be made (0)
    I just want to let everyone know I have updated my list of money making websites and in my opinion
    the 10 listed are the most reliable and honest money making sites that are free to join available.
    Please review this blog and let me know what you think http://makeeasymoney247.blogspot.com ....
  3. Please Can You Review My Blog
    List of recommended sites for making money online (3)
    I am currently in the process of constructing a list of the best sites through which to make money
    online and would like people to take a look at the sites I have added so far. I am obviously still a
    long way of completing it but just wondering whether people think it is a good site / idea
    http://makeeasymoney247.blogspot.com Also if you have not yet signed up to ClixSense I would
    highly recommend it. You can join for free but you are better of paying the small $10 yearly
    membership fee as this will bring you a ton more paid adverts - more than any other site I ....
  4. How Do I Find My Mysql Password? [resolved]
    Cannot access my MySQL (5)
    After all the recent problems, my account has been restored. I have setup my parked domain agin, and
    that works fine. However, I can no longer access my MySQL databases (I can from PHPMyAdmin, but
    that's all). I had to create a new user for my databases, and created the user with exactly the
    same username and password I had before, but some of my web pages do not let me access the pages I
    have associated with my databases. Where could i find out what my DB password is? (Although I am as
    good as sure I am using the right one). I have tried my old password, the new c....
  5. Please Explain Me Mysql
    How do i insert information into this config: (4)
    Hi, I wanted to try just to test how can i connect my website to another mysql server, but i have no
    idea how to insert the other mysql information such as port and host etc.... so here is the config
    file please give me an example CODE <?php // mySQL information $server =
    'FRESHSQL.COM:3306';                   // MySql server $username =
    'vasilevich';                      // MySql Username $password =
    '*******';                         // MySql Password $database =
    'vasilevich';                  // MySql Da....
  6. Arrays And List Boxes
    VB6 Codes needed (2)
    Hello Guys, I am working on an application. It is such that there are 2 list boxes or combo boxes.
    One is Labeled Departure and the other is labeled Destination. The boxes contain various states in
    America and each state has its unique feature of distances. The difference of the distances has to
    be reflected on a label. Where I need help is a code to execute the contents of the array into
    values For instance: Option Explicit Private Type Stateinfo statedeparture as integer
    stateDestination as integer TotalDistance as integer End Type Dim StateDistance ....
  7. Remote Access Mysql
    (8)
    Is it possible to directly access my local database from my website? For example, if somebody
    submits info on my website, the info they submitted would be transferred to my local database
    directly. Is that possible? And if so, how do I set that up? The reason I don't want to upload
    my database to my subdomain is because it would be difficult to keep the website database and my
    local database in sync . . . or is there a way to do that? Thanks for any replies.....
  8. How To Make An Ultimate Game List.
    If you're making a site on video games or such. (0)
    Hello. I am BuBBaG. You can call me Bubba for short. I'm going to show you how to make an
    Ultimate Game List. First off, we need to make a database, we are going to call this database
    `my_db`, leave out the `'s. Inside that database we will need to create a table
    called `ugl'(Ultimate Game List, duh). To make the table, simply enter this in the Syntax.
    CODE CREATE TABLE ugl ( System char(50), Game char(50), ) In the
    above code, it is stating we are creating a table called ugl, with two columns, System, and Gam....
  9. Create Table - Mysql Code - Help
    (1)
    I need your feedback about setting the database issues. Please, review them and correct some entries
    in the code if they got some mistakes. This is the code itself: SQL CREATE TABLE
    `news` ( `id` int(250) NOT NULL auto_increment, `title` varchar(255)
    NOT NULL default '', `text` text NOT NULL, `author` varchar(255) NOT
    NULL default '', `valid` varchar(255) NOT NULL default '',
    `date` varchar(255) NOT NULL default '', PRIMARY KEY (`id`) ) ENGINE = ....
  10. Mysql Error
    (3)
    ok i need some more help from the wonderful coders here at Trap. I'm almost done with my CMS
    script, but i'm having a problem with the installer.php file, when it trys to inseret the user
    data into the database i keep getting the following error: CODE mySQL Error: You have an
    error in your SQL syntax; check the manual that corresponds to your MySQL server version for the
    right syntax to use near ';INSERT INTO `members` (`id`, `name`,
    `username`, `password`, `email`, `title`) ' at lin....
  11. Mysql
    Several files in one field. (2)
    Hi guys. I want t know if it is posible to have so many entries for one object in a field in MySQL.
    I know my question may not be clear because I lack in terminology but pliz try and help. What I want
    to do is for axample have a database of my clients with the following fields for every client:
    fname, lname, more than one photos, contrubutions(comments, jokes, testimonials posted) etc. I want
    to have the things like the photos in the same field but they have to be unique so that my php code
    can deal with them individually llike they are coming from different fields.....
  12. Posts To Mailing List Are Blocked
    Every post to the mailing list returns a Delivery failure notice. (1)
    The mailing list appears to be intact but every attempt to post to it receives a Delivery failure
    notice. Here are 2 examples from 2 different emails. QUOTE
    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ---------------------------------EXAMPLE
    NOTICE #1--------------------------------------
    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> This is an automatically generated Delivery
    Status Notification Delivery to the following recipient failed permanently:
    future@renaissance.trap17.com Technical details of permanent failure: PERM_FAILURE: Gm....
  13. Html Form!
    Using MySQL?! (4)
    Hey, I need your help again! I need some good working tutorial how I can update my SQL through
    HTML form. I did use some tutorials online found with the help of google; but they do not work
    properly; I mean there are still small mistakes. I need to have a good tutorial to follow. It
    should be based on security and more things. It has to be done in proper way.......
  14. The Coding Group
    (22)
    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) , ....
  15. Can Anyone List Some Good Urls For Photoshop Brushes?
    (5)
    I've been dying to find some good brushes. But all the ones I can find are on deviantart.com but
    they aren't exactly what I'm looking for. I'm looking for different types of brushes
    like brand types, peace signs, flowers and stars. Do you guys know any other good sites where I can
    find these brushes? Thank You So Much! If you want, you can help post some sites for other
    types of brushes that you enjoy using!....
  16. List Of Free Directories To Submit Your Websites
    (7)
    Hi: Submission in free directories is a world-known way to increase ranking and traffic. But most
    of you don't know a good source of that list of directories. Here is a great source of free
    directories list . Just start submission in those directories in your free time, and see you
    ranking.......
  17. Mysql-essential-5.0.51 Installion Problem
    please help me.(urgent) (2)
    Dear friend, please help me. Iam working on php project (matchmaking site). I have downloaded mysql
    essensial 5.0.51. When i was installing mysql 5.0.51, i got following error - Error 1901: Error
    attempting to read from the source installation database:
    c:\windows\installer\527ec6.msi What is solution of this problem ? Iam using
    windows xp professional version 2002 (service pack 2). Please post your reply. Iam waiting for your
    answer. ....
  18. Database With Mysql++
    getting mySQL++ to work with trap17 (7)
    Hi, I'm trying to build an online game and figured the easiest way to do the server list would
    be to make a mySQL database for it; however, I use the con() command on the IP i get from pinging my
    website and I always get an abnormal program termination; however, it will work with the mySQL on my
    own machine. The code is below: CODE #include <iostream> #include <iomanip>
    #include <mysql++> #include "pass.h"//holds my password (i program at
    school) int main(void) {     Connection con("t3jem3_test","....
  19. Tools Needed!
    PHP & MySQL (9)
    Hello, everyone! I need some tools for those two things to test PHP scripts coming together with
    database on my laptop, instead checking them on a web-server which takes time.....
  20. 157 Of The Best Free Software On The Net
    Freeware Software List (7)
    I nearly had a heart attack when I saw this e-magazine (PC Magazine) on a website that will remain
    nameless just because of the nature of this website. Anyway with my wonderful pdf extracting skills
    I cut the pages down, and if all goes well the links to the original article should still work. So
    what kind of software are we talking about well I put it like this you might already have them,
    software covers Operating Systems, Antivirus/Anti-Malware, Firewalls, Security, Finance, Office,
    Calendar/PIMs, Backup/Sync, App Launchers, Utilities, Downloads, Interface Enhanceme....
  21. Mysql + Php Question
    (5)
    Hi, I am creating a website in php and using a mysql database to store the data. I want to store
    time data in the database. My question is what is the best datatype I should use and how do I read
    the time from the database and format(display) it using php ?....
  22. Mysql Won't Update
    (4)
    Ok, so I'm making some arcade administration software so I don't have to add games the hard
    way, well anyway, one of the features I have is that on the homepage is a featured author and as
    such I just have it so it updates one line in the mySQL. Well, the page with the form passes on the
    varibles fine and the updating page recieves them because I echoed everything, then I build the
    query and I even echo the query and it comes out exactly how I want it to, but for some reason, the
    database itself won't update even though all the varibles are there. Here's....
  23. Qupis : Free Hosting With Php, Mysql, Cpanel. (one Line Text Ad At Bottom)
    a member of Xisto (41)
    Hello Members, We are proud to introduce a new member to Xisto group of sites.
    Qupis : Free Web Hosting 150 MB space, 5000 MB Bandwidth, php,
    mysql, CPanel (Latest). Emails, FTP, Addon domains, Parked Domains etc.
    http://www.Qupis.com
    Feel free to add your reviews and comments about it. -Trap17
    Management ....
  24. Is It Possible To Access The Mysql Remotely?
    (10)
    I like to experiment with a lot of things and I was thinking of making a sort of instant messenger
    in Python, but I want to let people have actual accounts so I need to be able to access the mySQL
    remotely. If that's not possible, are we allowed to run Python scripts on the server?....
  25. Check Referrer To Prevent Linking Yours From Other Sites
    Check referrer with Php and Mysql (8)
    Check Referrer Using Php To Prevent People Linking To Your Downloads From Other Sites Ever
    find that found some people are listing items, images and tuts and linking directly to the download
    url (those that are like my photoshop tutorial.php?id=0), which is a .php to count the number of
    downloads. To prevent this, you can add a piece of code to the download pages that checks which page
    referred them to the download page: if it's my domain, it downloads the file normally, if
    it's not, it will redirect to my home page instead. Important : Not all browser....
  26. A List Of Awesome Free Fps'
    (first person shooters) (29)
    Ok, so here's an awsome list of some free first person shooters that AREN'T CRAP. These are
    actually made by the pros. these are for all PC OSes. Wolfenstein - enemy territory Nexuiz
    America's Army- special forces Counter Strike edit: I'm dumb. Legends ....
  27. Mysql Database Size
    related to the free database space (6)
    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....
  28. Import From Excel File Into Mysql Database
    (7)
    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....
  29. List GMail Giveaway
    (58)
    The following are people who are willing to giveaway their invites. If you need them, you can refer
    to this list: OrionLeingod = stoneddevil(at)gmail(dot)com Random = boomba.is(at)gmail(dot)com
    rmdort = rmdort(at)GMail(dot)com TWIXMIX = ryan.nielson(at)GMail(dot)com chakhei =
    peter4all(at)rediffmail(dot)com or PM him Afula = ivgenib(at)GMail(dot)com Bandit =
    bandit.mafiot(at)GMail(dot)com Emilin =emi.babe AT gmail DOT com nate9000 = nate9000 (AT) gmail
    (DOT) com gowron = paul(at)magielse(d0t)com Darthbob = therealdarthbob AT gmail DOT com TheStand
    = Bren....
  30. Complete Login System
    With PHP + MYSQL (56)
    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....

    1. Looking for group, mysql, results, list

Searching Video's for group, mysql, results, list
Similar
Database Or
Pdf - Best
way to list
books on my
site
Recommended
List Of
Money Making
Sites - A
list of 10
sites from
which easy
money can be
made
Please Can
You Review
My Blog -
List of
recommended
sites for
making money
online
How Do I
Find My
Mysql
Password?
[resolved] -
Cannot
access my
MySQL
Please
Explain Me
Mysql - How
do i insert
information
into this
config:
Arrays And
List Boxes -
VB6 Codes
needed
Remote
Access Mysql
How To Make
An Ultimate
Game List. -
If
you're
making a
site on
video games
or such.
Create Table
- Mysql Code
- Help
Mysql Error
Mysql -
Several
files in one
field.
Posts To
Mailing List
Are Blocked
- Every post
to the
mailing list
returns a
Delivery
failure
notice.
Html
Form! -
Using
MySQL?!
The Coding
Group
Can Anyone
List Some
Good Urls
For
Photoshop
Brushes?
List Of Free
Directories
To Submit
Your
Websites
Mysql-essent
ial-5.0.51
Installion
Problem -
please help
me.(urgent)
Database
With Mysql++
- getting
mySQL++ to
work with
trap17
Tools
Needed!
- PHP &
MySQL
157 Of The
Best Free
Software On
The Net -
Freeware
Software
List
Mysql + Php
Question
Mysql
Won't
Update
Qupis : Free
Hosting With
Php, Mysql,
Cpanel. (one
Line Text Ad
At Bottom) -
a member of
Xisto
Is It
Possible To
Access The
Mysql
Remotely?
Check
Referrer To
Prevent
Linking
Yours From
Other Sites
- Check
referrer
with Php and
Mysql
A List Of
Awesome Free
Fps' -
(first
person
shooters)
Mysql
Database
Size -
related to
the free
database
space
Import From
Excel File
Into Mysql
Database
List GMail
Giveaway
Complete
Login System
- With PHP +
MYSQL
advertisement



How To Group Mysql Results In A List



 

 

 

 

ADD REPLY / Got an Opinion! Remove these ADs! RAPID SEARCH! Free Web Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
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