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
	) VALUES (
	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!

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.