Answer
In MySQL, Strings (VARCHARs) are surrended with single quotes (ie '). You are using double quotes " arround your values. That's why you gave an error.
Explanation
If we take your $query and we replace calls to mysqli_real_escape_string and md5 with values foo and bar just to see what happens PHP replaces with the real values; the resulting string would be:
'INSERT INTO `users` (`email`, `password`) VALUES("'. 'foo' .'", "' . 'bar'. '")'
which gives after concatenations
'INSERT INTO `users` (`email`, `password`) VALUES("foo", "bar")'
You can clearly see that values are using " which will not work in MySQL.
Solution
The solution would be si,ply to use ' for values. This can be done in two ways:
Using " for the whole string and ' inside for values
"INSERT INTO `users` (`email`, `password`) VALUES('foo', 'bar')"
which gives
$query = "INSERT INTO `users` (`email`, `password`) VALUES('".mysqli_real_escape_string($link, $_POST["email"])."', '".md5(md5($_POST["email"]).$_POST["password"])"')";
Using ' for the whole string and escaping the ' of values using \
'INSERT INTO `users` (`email`, `password`) VALUES(\'foo\', \'bar\')'
which gives
$query = 'INSERT INTO `users` (`email`, `password`) VALUES(\''.mysqli_real_escape_string($link, $_POST["email"]).'\', \''.md5(md5($_POST["email"]).$_POST["password"])'\')';
Important Notes