I Have some request like below :
$input = "$POS,1234,5223,A,2719";
If get a request like above , process an save to database with below code :
$input_ex = explode(",", $input);
$input_ex[0];
$input_ex[1];
$input_ex[2];
$input_ex[3];
$input_ex[4];
mysql_query("INSERT INTO table_name (cl_1,cl_2,cl_3,cl_4,cl_5)
values ('$input_ex[0]','$input_ex[1]','$input_ex[2]','$input_ex[3]','$input_ex[4]')
Problem:
my inputs may be sometimes more than one and split with ‘ # ‘ character
last row of inputs is maybe have ‘ # ‘ character too
$input = "$POS,1234,5223,A,2719#
$POX,752,4342,N,SXD#
$POZ,122,6242,B,XFB#";
How can i separate each row and insert it on database as a new row ?
thanks 😉
edit :
inputs is 3 different mode , 1st is a one row without any # sign , 2nd is have more row with end # on last row , 3th more row without # sign on end of last row
1 Answer