Re: To Loop or Not to Loop?

From: Date: Mon, 17 Nov 2003 20:09:32 +0000
Subject: Re: To Loop or Not to Loop?
Groups: php.general 
Request: Send a blank email to php-general+get-169999@lists.php.net to get a copy of this message
<snip> The code below inserts the same inventory item into the db multiple times - I just need 1 line entry for each inventory item, but multiple photos of each item....How to do this? I know the code I wrote below is extremely awful, but I am a nebie and that was the only way I could get it to half-way do what I am wanting </snip> First you can take you database connect statement out of your loop and put it somewhere before the loop, no need to connect multiple times. The second thing I would do, and this is just at a glance of the code, I would separate it into 2 tables, inventory(the table you already have) and inventory_pics (or something like that) and make that a one to many relationship, one row in the inventory table can have many rows in the inventory_pics table. I can take closer look at your code tonight.

« previous php.general (#169999) next »