I'm new to all this so excuse my ignorance. I want to test a table to see how many rows have a 'Y' in the 'CONNECTED' column of my table. If the row has a 'Y' then loop through the rows displaying the 'FIRST_NAME' and 'LAST_NAME' columns. If I just display the rows using: [code]while ($row = oci_fetch_row($stid)) { echo "<p class=\"yellowSix\">" . $row[0] . " " . $row[1] . "</p>"; } [/code] It works as expected but when I nest this in a test for number of rows it fails or in this case returns the else bracket of "No users online". The code I'm using looks like: [code] $sql = "select FIRST_NAME, LAST_NAME from CONTACTS where CONNECTED = 'Y'"; $conn = db_connect(); $stid = oci_parse($conn, $sql); oci_execute($stid); $nrow = oci_num_rows($stid); if ($nrow > 0 ) { while ($row = oci_fetch_row($stid)) { echo "<p class=\"yellowSix\">" . $row[0] . " " . $row[1] . "</p>"; } } else { echo "No users online"; } [/code] Where did I go wrong?