PHP, MYSQL and Multiple Records - AGAIN :<

From: Date: Wed, 04 Apr 2001 01:51:22 +0000
Subject: PHP, MYSQL and Multiple Records - AGAIN :<
Groups: php.general 
Request: Send a blank email to php-general+get-46939@lists.php.net to get a copy of this message
OK, Here is my LAST shot at this, I mean it this time I used the code that Lindsay Adams was nice enough to give me, THANKS AGAIN. I have made few minor adjustments and one question. Should I be calling out the PHOTOID field I have in my database for storing? It is my primary key set to auto increment and not null. Shouldn't it count on its own? Back to this other problem.... It will not insert more than ONE description. (When you run it like I have pasted here, this version returns values to the screen) <? if(isset($submit)): $query = "INSERT INTO pictures (photono, photodesc, photodate) VALUES"; for($I=0;$I < count($photono); $I++) { if(!($I == 0)) { if(!($photodesc[$I] =="") ) { $query .="('$photono','$photodesc[$I]','$photodate')"; } } else { if(!($photodesc[$I] =="") ) { $query .=",('$photono','$photodesc[$I]','$photodate')"; } } } print $query; print("<h2>The data has been entered</h2>\n"); endif; ?> <form action="http://localhost/pic2.phtml" method="post"> Picture Number:<br><input type="text" size="20" name="photono"><p> Picture Description:<br><input type="text" size="40" name="photodesc[ ]"><p> Picture Description:<br><input type="text" size="40" name="photodesc[ ]"><p> Picture Description:<br><input type="text" size="40" name="photodesc[ ]"><p> Picture Description:<br><input type="text" size="40" name="photodesc[ ]"><p> Picture Date:<br><input type="text" size="8" name="photodate"><p> <input type="submit" name="submit" value="Submit Picture"> </form> </body> </html> After I get this attempt, I am going back to my other job "Brain Surgery" Thanks in advance "Sorry to be such a pain" Curtis

« previous php.general (#46939) next »