mysql_fetch_array

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Maximus

    #1

    mysql_fetch_array

    I do a query that select latest 3 records in the database table.

    Now after doing the query, i need to echo it's results in 3 different
    tables, 1 big, and 2 small below the big one.

    how can i do that?

  • Geoff Berrow

    #2
    Re: mysql_fetch_arr ay

    Message-ID: <1151836878.677 813.324590@b68g 2000cwa.googleg roups.comfrom
    Maximus contained the following:
    >Now after doing the query, i need to echo it's results in 3 different
    >tables, 1 big, and 2 small below the big one.
    >
    >how can i do that?
    while($myrow=my sql_query($sql) {
    $table[]=$myrow;
    }

    $table is then an array containing your three rows
    ($table[0],$table[1],$table[2]).

    Loop through it using foreach to extract the data any way you choose.

    --
    Geoff Berrow (put thecat out to email)
    It's only Usenet, no one dies.
    My opinions, not the committee's, mine.
    Simple RFDs http://www.ckdog.co.uk/rfdmaker/

    Comment

    • Maximus

      #3
      Re: mysql_fetch_arr ay

      But the while($row=mysq l_query($sql)) {

      }

      is giving me some infinite loop, the whole pc would freeze as the
      script won't stop
      any solution? or explanation

      Geoff Berrow wrote:
      Message-ID: <1151836878.677 813.324590@b68g 2000cwa.googleg roups.comfrom
      Maximus contained the following:
      >
      Now after doing the query, i need to echo it's results in 3 different
      tables, 1 big, and 2 small below the big one.

      how can i do that?
      >
      while($myrow=my sql_query($sql) {
      $table[]=$myrow;
      }
      >
      $table is then an array containing your three rows
      ($table[0],$table[1],$table[2]).
      >
      Loop through it using foreach to extract the data any way you choose.
      >
      --
      Geoff Berrow (put thecat out to email)
      It's only Usenet, no one dies.
      My opinions, not the committee's, mine.
      Simple RFDs http://www.ckdog.co.uk/rfdmaker/

      Comment

      • Rik

        #4
        Re: mysql_fetch_arr ay

        Maximus wrote:
        But the while($row=mysq l_query($sql)) {
        >
        }
        >
        is giving me some infinite loop, the whole pc would freeze as the
        script won't stop
        any solution? or explanation
        Should offcourse be:
        $result = mysql_query($sq l);
        while($row = mysql_fetch_arr ay($result)){

        }

        Now, it's just querying over and over again, and as long as the MySQL
        server doesn't return false, it will requery it..

        Grtz,
        --
        Rik Wasmus


        Comment

        • Geoff Berrow

          #5
          Re: mysql_fetch_arr ay

          Message-ID: <8e78b$44a7db5d $8259c69c$7236@ news1.tudelft.n lfrom Rik
          contained the following:
          >Should offcourse be:
          >$result = mysql_query($sq l);
          >while($row = mysql_fetch_arr ay($result)){
          >
          >}

          What he said.

          Memo to self - don't post before coffee...
          --
          Geoff Berrow (put thecat out to email)
          It's only Usenet, no one dies.
          My opinions, not the committee's, mine.
          Simple RFDs http://www.ckdog.co.uk/rfdmaker/

          Comment

          Working...