Hi i have a comma separated. Each seperated value contains a string which is seperated by a "|".. I need to explode the second string and insert the multiple data into the dB..
here is my code:
here is my post data example:
PHP Code:// name|surname|acc@domain.com|contact,johnny|smith|jsmith@jjjjj.com|contact, and so on.. I need to insert the individual data into the db and if successful echo 1 else error..
$contacts = $_POST['conts'];
if(!empty($contacts)){
$one[] = explode(',',$contacts);
foreach($one as $two){
$three[] = explode('|', $two);
foreach($three as $four){
$sql="INSERT INTO jos_mycont (`prop_userid`,`category`,`firstname`,`surname`,`email`) VALUES ('$thisJRUser->id','$four[3]','$four[0]','$four[1]','$four[2]')";
mysql_query($sql,$contLink);
}
if (!mysql_query($sql,$contLink)){
echo "Unable to insert client details";
exit;
} else {
echo '1';
exit;
}
}
} else {
echo 'No contacts selected';
exit;
}



Reply With Quote

Bookmarks