hi, first post here, hope i get some help.

Usually it's $row[field_name] when working with mysql data, but there's no field '0' in the table, so it could probably be current row or first row or something else. and what would then $row[1] etc. mean then? thanks for your answers

    Hi,

    $row[0] refers to the first position in the array variable $row. (Unfortunately it was not designed to be $row[1]..

    So the second position in the array would be $row[1]

    J.

      Just to add on to leatherback's answer . . .

      You seem to be asking about when you see the $row[0] used from fetching database results, right?

      There are two kinds of arrays: numeric-based and associative. Numeric based means you access different values in the array using numeric keys. Associative means you access different values in the array using words as the keys. For example:

      Associative: $row["field_name"], $var["item1"], $bla["fname"], etc

      Numeric: $row["0"], $var["803"], $bla["7"], etc

      If you use mysql_fetch_array(), you have access to both an associative array and numeric array.

      If you use mysql_fetch_assoc(), you only have access to an associative array.

      (Both of those functions are used to fetch results out of a mysql database into an array)

      Hope this clears up any confusion.

      Cgraz

        Write a Reply...