date from-to

Einklappen
X
 
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

  • date from-to

    i guess this qould be a simple question.

    what i want to do, is take out the info from a MySQL base with a php file.
    what i need is the php file to take out the info recorded from 9.00 AM till 9.00 PM and then maybe minus this info from all to get the from 9.00 PM till 9.00 AM. Or maybe just take the info recorded from 9AM-9PM and the with a seperate function from 9PM-9AM.

    the thing is what i try to achieve here is:
    i record the internet traffic and would like to see how much info in received (in MB) @ daytime and sent @ daytime and how much info is sent @ nightime and received @ nighttime.

    Thank You!

  • #2
    Perhaps something like

    SELECT...
    FROM...
    WHERE HOUR(datefield) > 9 AND HOUR(datefield) < 21

    ???

    I'll move you to the SQL-Forum!

    Kommentar


    • #3
      ok, i have this code:

      PHP-Code:
      $query "select round(sum(received)/1024/1024) from statistika where name=\"$login\" and date>\"20020431\"";
      $received sql_query($query); 

      and date>\"20020431\"";???
      what about this line? could someone tell me if it's possible to get the info @ the same day 2002.04.31, but from 9AM till 9PM. is it possible to write it in a query ?

      Kommentar


      • #4
        Have you tried your query? think this cant work.

        what are you doin here: round(sum(received)/1024/1024) ??? Are this dthe Megs?

        is your date realy jjjjmmmdd?

        Kommentar


        • #5
          no, this is just some stupid date , ant yes, these are the Megs.
          umm... what i would like it to do, is to show the number of megs used from 9AM till 9PM. is it possible to do it in a query ?

          Kommentar


          • #6
            let's say that the data of my table renews every hour, i mean that i get new info about the used Megs every hour.

            Kommentar


            • #7
              if you have only saved the date, how do you want to select if its day or night?

              Kommentar


              • #8
                can you give me a sample of one or two rows of your db?

                Kommentar


                • #9
                  i have 5 fields :
                  name varchar(20) No
                  date date No 0000-00-00
                  time time No 00:00:00
                  received int(10) UNSIGNED ZEROFILL Yes NULL
                  sent int(10) UNSIGNED ZEROFILL Yes NULL

                  ---name------date------time------received------sent
                  navickas 2001-06-09 04:30:01 0006894864 0000682548
                  infonora 2001-06-09 04:30:01 0000000000 0000000000
                  navickas 2001-06-09 04:45:01 0006781949 0000601459
                  infonora 2001-06-09 04:45:01 0000000000 0000000000
                  navickas 2001-06-09 05:00:01 0006190623 0000423495
                  infonora 2001-06-09 05:00:01 0000000000 0000000000
                  navickas 2001-06-09 05:15:01 0003604529 0000509482
                  infonora 2001-06-09 05:15:01 0000000000 0000000000
                  navickas 2001-06-09 05:30:01 0005940272 0000453280
                  infonora 2001-06-09 05:30:01 0000000000 0000000000
                  navickas 2001-06-09 05:45:01 0003984640 0000395596
                  infonora 2001-06-09 05:45:01 0000000000 0000000000
                  navickas 2001-06-09 06:00:01 0006020221 0000375160
                  infonora 2001-06-09 06:00:01 0000000000 0000000000
                  navickas 2001-06-09 06:15:01 0005930095 0000789272


                  as you can see, the info is renewed every 15 mins.

                  Kommentar


                  • #10
                    PHP-Code:
                    $query "select round(sum(sent)/1024/1024) from STATISTIC  where name=\"$login\" and date=?????????; 
                    maybe i'm doing it in a wrong way, but what i need the query to do is to sum the SENT Mbytes from this month's 9AM-9PM and the another query form 9PM till 9AM

                    Kommentar


                    • #11
                      $query = "select round(sum(sent)/1024/1024) from STATISTIC where name='$login' and HOUR(time) > 9 and HOUR(time) < 21;

                      Kommentar


                      • #12
                        and what about ONLY THIS MONTH ???

                        Kommentar


                        • #13
                          THANX FOR ALL THE HELP ALREDY RECEIVED!!!

                          Kommentar


                          • #14
                            No prob, therefore im here...

                            I'll talk to you when I get english homework

                            Try

                            AND MONTH(datum) = x

                            x can be number from 1 to 12.

                            Kommentar


                            • #15
                              THANX ! works like a charm! Will help with your English

                              Kommentar

                              Lädt...
                              X