brianab Posted June 25, 2009 Share Posted June 25, 2009 Using PHP, I set up two for loops one inside the other with a database read statement in between. This works fine for small loops but on larger loops the data just dissappears. The scipt completes without error. <?php $END=174; $SUBJECTLIST=array("aa","bb","cc"); //Total OF 40 ELEMENTS for ($x=0; $x < $END; ++$x) { for ($c=0; $c < 40; ++$c) { // OPEN DATABASE $conn=odbc_connect('xxx','',''); if (!$conn) {exit("Database Connection Failed: " . $conn);} $sql="SELECT * FROM $DATABASE WHERE a2='$Identity[$x]' and a11='$SUBJECTLIST[$c]'"; $rs=odbc_exec($conn,$sql); if (!$rs) {exit("Error in $DATABASE SQL");} while (odbc_fetch_row($rs)) { $NAME[$x]=odbc_result($rs,"a2"); $Information[$x]=odbc_result($rs,"a11"); // Twenty other odbc_result statements }// End of WHILE odbc_free_result($rs); odbc_close($conn); // Printing out the values, the data suddenly stops. Each time varying by a couple of // rows. } } ?> Why does this occur ? Is there a better way of coding ? Any help please.. Regards, Brian Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.