What are some common pitfalls when using oci_fetch_array() multiple times in PHP?

When using oci_fetch_array() multiple times in PHP, a common pitfall is that it moves the internal pointer of the result set each time it is called. This means that subsequent calls to oci_fetch_array() will return the next row in the result set, potentially skipping rows or returning false prematurely. To avoid this issue, you can store the result of oci_fetch_array() in a variable and then work with that variable instead of calling oci_fetch_array() multiple times.

// Store the result of oci_fetch_array() in a variable
while ($row = oci_fetch_array($stmt, OCI_ASSOC)) {
    // Work with the $row variable instead of calling oci_fetch_array() again
    // Process the data from $row
}