MySQL不接受PHP查询[重复]

I have an issue.
I have a field where you can enter something like this:

word|secondword|third|fourth
and|more|and|more

So I thought that doing an explode like this should be fine:

$linebyline = explode("
", $_POST['message']);
for ($i=0;$i<100;$i++){
  $exploded = explode("$delimiter", $linebyline[$i]);

And in the for loop I added a statement like:

$query = ("insert into homesweet(phone,sensitive,vagisil) values('$result','$exploded[$experience]','$exploded[$name]');

But it works if I copy-paste it in MysQL. It does not if I use it by PHP. Throwing just cannot execute the query. Also, it says:

PHP Notice: Undefined offset

And:

PHP Notice: Undefined index

Not working query: $query = ("insert into homesweethome(trashcan,exp,seller,name,zip,city,state,country,dobmonth,dobyear,ssn,address,price,phone) values('$result','$exploded[$exp]','$username','$exploded[$name]','$exploded[$zip]','$exploded[$city]','$exploded[$state]','$exploded[$country]','19','1990','$exploded[$ssn]','$exploded[$address]','$exploded[$price]','$exploded[$phone]'");

</div>

You can replace all the new line caracters from the received string with your delimiter and use explode() only once.

$receivedString = "word|secondword|third|fourth
and|more|and|more";

$linebyline = preg_replace('/\s+/', '|', $receivedString);


$exploded = explode("|", $linebyline);

$query = "INSERT INTO table_name(column0, column1, column2, column3, column4)
VALUES('$exploded[0]', '$exploded[1]', '$exploded[2]', '$exploded[3]', '$exploded[4]')";

echo $query;