mysql_query

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

  • mysql_query

    PHP-Code:
    $rezult mysql_query("SELECT round(sum(issiusta)/1024/1024) from statistika where vardas='templas' and HOUR(laikas) > 9 and HOUR(laikas) < 21");
    echo 
    $rezult
    from this i get :

    Resource id #3

    while i should be getting some number like 7689 or 2564 ...

  • #2
    you should try:

    PHP-Code:
    if ( $rezult mysql_query("SELECT round(sum(issiusta)/1024/1024) from statistika where vardas='templas' and HOUR(laikas) > 9 and HOUR(laikas) < 21") ) {
        
    $row mysql_fetch_row($rezult);
        echo 
    $row[0];
        
    mysql_free_result($rezult);

    Zuletzt geändert von goth; 18.03.2003, 19:44.
    carpe noctem

    [color=blue]Bitte keine Fragen per EMail ... im Forum haben alle was davon ... und ich beantworte EMail-Fragen von Foren-Mitgliedern in der Regel eh nicht![/color]
    [color=red]Hinweis: Ich bin weder Mitglied noch Angestellter von ebiz-consult! Alles was ich hier von mir gebe tue ich in eigener Verantwortung![/color]

    Kommentar


    • #3
      hmmm... now what i get is a blank page

      Kommentar


      • #4
        PHP-Code:
        $rezult mysql_query("SELECT round(sum(issiusta)/1024/1024) from statistika where vardas='templas' and HOUR(laikas) > 9 and HOUR(laikas) < 21");
        while (
        $row mysql_fetch_row($rezult))
          echo 
        $row[0].'<br />';
        mysql_free_result($rezult); 
        maybe this works a lil bit better
        Ich denke, also bin ich. - Einige sind trotzdem...

        Kommentar


        • #5
          woo!!hoo!!! it works THANK YOU! could you please explain the difference between your 2 replies? and why didn't the 1-st one work ? :/
          thanx!

          Kommentar


          • #6
            $rezult = mysql_query... performs the query
            while ($row=mysql_fetch... means: repeat the following step as long as there's still a recordset left
            echo $row[0].'<br />' print the recordset to the user's screen and print a <br /> so that each entry will be in a single line
            mysql_free_result frees the result
            Ich denke, also bin ich. - Einige sind trotzdem...

            Kommentar

            Lädt...
            X