Never ending (for) loop
От | Blks |
---|---|
Тема | Never ending (for) loop |
Дата | |
Msg-id | 003e01bee8d2$7c324cc0$9c3efdd0@ibm обсуждение исходный текст |
Список | pgsql-general |
I wanted to thank everyone who helped me witht he postgesql limit query. I used the examples you fella's gave and they worked great. Thanks again. How would I quite the for loop however? If I have only 103 rows in a table, how do I get the for loop to stop cycling through? any suggestions are greatly appreciated. <SCRIPT language="PHP"> if (!isset($iStart)) { $iStart = 0; } if (!isset($iEnd)) { $iEnd = $iStart + 10; } $conn = pg_Connect("", "", "", "", "contact_list"); if (!$conn) { echo "An error occurred.\n"; exit; } $result = pg_Exec($conn, "SELECT * FROM contact_list"); if (!$result) { echo "An error occurred.\n"; exit; } for ($iWalk = $iStart; $iWalk < $iEnd; $iWalk++) { $resArray = pg_fetch_array($result, $iWalk); echo "<TR> <TD> $resArray[2] </TD> <TD> $resArray[3] </TD> <TD> $resArray[4] </TD> <TD> $resArray[6] </TD> <TD> $resArray[1] </TD> <TD> $resArray[0] </TD> <TD> <center> $resArray[8] </center> </TD> </TR> "; } echo "<a href=\"$PHP_SELF?iStart=$iEnd\">Next 10</a>"; pg_FreeResult($result); pg_Close($conn); </script> Thank You, Blake S
В списке pgsql-general по дате отправления: