Okay, I don't understand this at all. Maybe someone more polished could help me. I am trying to enter a group of numbers into the database using PHP and it works on my personal server, but then when I try it online it only takes the first number of the group. Is it possible that the online server has some sort of protection against filling the database with numbers? I just don't get it. Here's my code:

$percentage = mysql_prep($_POST['percentage']);
	$chosen_answers = mysql_prep($_POST['chosen_answers']);
	$chosen_answers = explode(",", $chosen_answers );
	$username = $_SESSION['username'];
	foreach($chosen_answers as $value) echo $value.'<br />';
	$tstring = implode(',' , $chosen_answers); 
	foreach ($chosen_answers as $value) echo ($value.'<br>');
	$tstring = implode(',', $chosen_answers);

$query = "INSERT INTO bi_users_quiz_takers (
	id, username, percentage, answers
	NULL, '$username', $percentage, '($tstring)'

Like I said, it works perfectly on my personal server, but on the online server I only get the first number. Any ideas what I should do? Thank you!

8 Years
Discussion Span
Last Post by Pado

I fixed it, but I had to change mysql so that I could enter a VARCHAR instead of a INT, join the different numbers together to put them in the database, and then str_split them on the way out so I could show they were separate problems. I still don't understand why it didn't work the other way, the way it worked on my server.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.