Re: PHP Is Inserting (the same) Database Record Multiple Times In My HTML Output
| From: | Erik Price | Date: | Fri, 15 Mar 2002 15:08:33 +0000 |
| Subject: | Re: PHP Is Inserting (the same) Database Record Multiple Times In My HTML Output | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-88657@lists.php.net to get a copy of this message | ||
On Friday, March 15, 2002, at 12:19 AM, hugh danaher wrote:
You're the second one I've seen using "do". What "do"? Is it in the php manual and I missed it?do { ... } while ( ... ); Runs the while loop at least once, regardless of whether or not the while conditional evaluates to TRUE. Somewhat unrelated, but I used to use this technique for looping through a result array from a mysql_fetch_*() function if the internal array pointer has already been bumped to the second position by a containing while loop. Now I just use two result container variables instead of the same one, since it's conceptually a little cleaner (than worrying about the array pointer's position for two separate loops that overlap each other).
I changed your code slightly (to major if it's your baby). It might puke if the $row is empty for the While loop. If it does, try an @ sign before the while. I didn't test it but it looks like should go. Or, generate some interesting error messages.My experience with programming is limited, but I was under the understanding that the @ sign should be used only suppress possible unexpected error messages from users; that using it to suppress known errors is really not as good a solution as finding out what is causing the error and fixing it... of course, sometimes in a pinch you have to MacGuyver the thing I guess. Just some advice :) Erik ---- Erik Price Web Developer Temp Media Lab, H.H. Brown pricee@hhbrown.com