Re: Weird while issue

From: Date: Tue, 27 Apr 2010 13:25:05 +0000
Subject: Re: Weird while issue
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-304649@lists.php.net to get a copy of this message
2010/4/27 Peter Lind <peter.e.lind@gmail.com>: > On 27 April 2010 14:36, Juan Rodriguez Monti <juan@rodriguezmonti.com.ar> wrote: >> Hi guys, >> I have some issues with while. >> >> I have an HTML Form, that uses GET to process its contents. Then >> there's a PHP Script that receives the data, and evaluates the fields. >> >> So, in some instance of the code, I do something like : >> >> if (empty($a) AND empty($b)) { >> >> echo "something"; >> echo "something"; >> echo "something"; >> >> while ($row = sqlite_fetch_array($results,SQLITE_BOTH)) { >> >> And here I print some echo's to print an HTML's Table with the results >> of the while. >> echo "Something more"; >> echo "etc"; >> >>            } >> } elseif (empty($c) AND empty($d)) { >> >> Here there is another elseif similar to the first one explained above. >> >> } >> >> I have four or five elseif's that analizes the fields of the HTML's >> Form and then the PHP's Code do things depending of the combinations >> of fields submited and so on. >> >> The problem is that if I want to add an echo saying "Come Back to >> Index" to index.html, I'm not able to show it after the while's >> iteration. >> >> The PHP code prints the table with its results taken from SQlite >> perfectly. Also it evaluates all the conditions flawessly. However, If >> I add a link to come back with the text "Go to Index" after the while >> and before the } close to the next elseif, PHP prints it in the wrong >> ubication. >> >> I got something like: >> >> TITLE >> >> *** Go to Index *** >> >> While results. This is the table containing all the results of the >> SQlite's Query. >> >> If I move the echo to other part of the block, I receive so many >> echo's as iterations the while do ( this is logical ). However I don't >> understand why the echo is printed above the while even when I put it >> after the while and out of the while's block. >> > > Check your html for broken html table code. > > Regards > Peter Hi Peter, That was the problem. Solved!. Thanks, Juan

« previous php.general (#304649) next »