My code only inserts the last value of the array into the database column. Even though when it runs for the foreach loop it echo's each of the expected values out of the array.

I'm pretty new to PHP so I'd be grateful for any help with this.

Thanks
NH

$values = $_GET['tta'];
echo "size of array = ".sizeof($values)."<br>"; 
foreach ($values as $question_equation) {
$sql = "INSERT INTO venn (question_equation) VALUES ('$question_equation')
	";
	//echo $values;
echo $question_equation;
}
	
	if (@mysql_query($sql)) {
echo '<p>questions added</p>';
} else {
echo '<p>ERROR questions not added' .
	mysql_error() . '</p>';
}

You need to put mysql_query inside the foreach loop as well..

$values = $_GET['tta'];
echo "size of array = ".sizeof($values)."<br>"; 
foreach ($values as $question_equation) {
$sql = "INSERT INTO venn (question_equation) VALUES ('$question_equation')
	";
	if (@mysql_query($sql)) {
echo '<p>questions added</p>';
} else {
echo '<p>ERROR questions not added' .
	mysql_error() . '</p>';
}
	//echo $values;
echo $question_equation;
}
This question has already been answered. Start a new discussion instead.