php - How to add single or double quote in every email address -
how add single or double quote in every email add sample
after implode email should
(red@yahoo.com, blue@yahoo.com, yellow@yahoo.com, white@yahoo.com)
convert array string to:
('red@yahoo.com', 'blue@yahoo.com', 'yellow@yahoo.com', 'white@yahoo.com')
or
("red@yahoo.com", "blue@yahoo.com", "yellow@yahoo.com", "white@yahoo.com") $num = count($email); for($i=0; $i < $num; $i++){ $result = do_post_request("http://api.myapi.com/api/isactiveaccount?email=". $email[$i], null); $status = str_replace('{"result":', "", $result); $status = str_replace('}', "", $status); $value_email[] = $email[$i] ; $value_status[] = $status ; } $val_email = implode(',',$value_email); $value_status = implode(',',$value_status); define ("verify_email_update_sent", " update `accounts` set sent = 1 email in (".$val_email.") , active <> 1"); $db->query(verify_email_update_sent); echo 'done'; error because ---->email in (red@yahoo.com, blue@yahoo.com, yellow@yahoo.com, white@yahoo.com)
then implode
string:
$result = '("' . implode('", "', $emails) . '")';
here's demo: http://codepad.viper-7.com/3suuci
Comments
Post a Comment