Well I replied to an old thread but as it is old it doesnt seem to be getting any activity as it is marked answered.
The thread is: http://forums.phpfreaks.com/topic/228584-insert-different-lines-from-textarea-to-different-mysql-rows/
This doesnt work. I have tried it so many different ways.
I have a textarea that has data like
Info1
Info2
Info3
Info4
Info5
I have a table that has an auto increment ID and a Name column and I want each line from the textarea in its own row inserted in the Name column.
The only reply to the thread says to try:
$lines = array_map('mysql_real_escape_string', explode("\n", $_POST['textarea']));
$values = "VALUES ('" . implode("'), ('", $lines) . "')";
$query = "INSERT INTO table_name (column_name) $values";
Which didnt work. Ive tried a bunch of different things and cant get this to work.
Here is my last attempt of trying to get the above to work:
$lines = array_map('mysql_real_escape_string', explode("\n", $_POST['TextArea']));
$values = implode("'), ('", $lines);
$query = "INSERT INTO Table (`ID`,`Name`) VALUES (NULL, '$values')";