Reputation: 177
How do i add single or double quote in every email add sample
after implode my email should be look like this
([email protected], [email protected], [email protected], [email protected])
convert that array string to:
('[email protected]', '[email protected]', '[email protected]', '[email protected]')
or
("[email protected]", "[email protected]", "[email protected]", "[email protected]")
$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 WHERE email IN (".$val_email.") AND active <> 1");
$db->query(VERIFY_EMAIL_UPDATE_SENT);
echo 'Done';
Error because ---->email IN ([email protected], [email protected], [email protected], [email protected])
Upvotes: 0
Views: 247
Reputation: 220026
Then just implode
with that string:
$result = '("' . implode('", "', $emails) . '")';
Here's a demo: http://codepad.viper-7.com/3suUci
Upvotes: 2