Hi, I've seen a few post for this same thing but I can't seem to get it
working. What I'm doing is taking a form with check boxes and putting them
into an array. Then I'm attempting to INSERT them into the db, one checkbox
value per row.

Okay,  well I've tries 2 ways that I think should work and they only insert
the first value. They both produce this error "Duplicate entry '0' for key
1" (which I don't understand) Anyway here is the code I'm trying...

(I'm not trying to use both blocks of code, just one or the other)

// First code
while(list($key,$value)=each($pagetype)){
//echo $value."<br>";//test
$links="INSERT INTO $username_links (links) VALUES ('$value')";
$insert=mysql_query($links,$connection);

}

// Second code attempt
$number=count($pagetype);
for($a=0;$a<$number;$a++){
$links="INSERT INTO $username_links (links) VALUES ('$pagetype[$a]')";
$insert=mysql_query($links) or die(mysql_error());
//echo $pagetype[$a];//test
}




Thanks in advance...Robert



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to