This will adds email ids one by one to database, which are separated with comma, there is no error..........! its working good but i need to understand that. $sql="insert into $tbl_name (email) values('". join("'), ('", preg_split('/\s*,\s*/', $email_addresses)). "')"; PHP: Any body tell me clearly what's happening hear..., please tell me clearly. values('". join("'), ('", preg_split('/\s*,\s*/', $email_addresses)). "')"; PHP: i mean why '/\s*,\s*/', and . join("'), ('", i am fresher please tell me...., in a clear way. i already read the consept on them but not understand clearly..!
Dear Pudge1, ya came to know that you don't know any thing abut php..., then please don't make any waste comments to increase your posts.. please its my request. dont waste your and my time.., that's i got from net and working find and now i need to understand.. thats it. ok
\s* = matches zero or more white space , = matches a comma \s* = matches zero or more white space The preg_split creates an array, so that join takes the array and puts each element one after another into a string, each element being separated by ),( so: if $email_addresses = 'a1@example.com,a2@example.com'; Then after the split you have and array: [0] = [1] = Then after the join a string: "a1@example.com), (a2@example.com Hope that helps.
Resources are here http://php.net/manual/en/function.preg-split.php http://www.phpdig.net/ref/rn53re1101.html Get into that