pro_se Posted April 10, 2007 Share Posted April 10, 2007 Wow, I don`t know what I would do without all of you, you all have helped me so much... Anyways, I have another problem that I am sure you all can figure out... I am currently attempting to insert user tags into a table on my database, I am using an WHILE statement to do this but PHP is acting fishy and its only inserting one of my array elements... Here is my code: function initialsetup($gender, $byear, $bmonth, $bday, $orientation, $tags, $uid) { if (($byear<1900)OR($byear>2100)) { header("Location: http://notexting.com/initial_setup"); } elseif (($bmonth<=0)OR($bmonth>12)) { header("Location: http://notexting.com/initial_setup"); } elseif (($bday<=0)OR($bday>31)) { header("Location: http://notexting.com/initial_setup"); } else { $eachtag = explode(", ", $tags); $repeat = 0; while (count($eachtag) > $repeat) { $uid = $_SESSION['userid']; $query = "INSERT INTO `tags` ( `uid` , `tag` ) VALUES ('$uid', '$eachtag[$repeat]')"; $insert_tags = mysql_query($query); $repeat++; } } } Please help! I am putting like 30 tags into the form and only one tag is being inserted into the DB!!! Quote Link to comment Share on other sites More sharing options...
pro_se Posted April 10, 2007 Author Share Posted April 10, 2007 Ok, apparently I am an idiot.. I set the primary key to UID so it would not insert more than one with the same value.. 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.