Code: Select all
//Perform SQL query
$query = sprintf("UPDATE `db1`.`kundendaten` SET `accepted` = '1' WHERE `kundendaten`.[b]`email` = '%s' [/b]LIMIT 1;", $email);
$query = sprintf($query);
mysql_query($query) or die ('Query failed: ' . mysql_error());....with "normal" Email addresses ($email) like hobo@hobo.com...
...but with hyphenated Email addresses like max-muster@hotmail.com it does not work. (mind the dash / hyphen / minus)
I did some testing:
1) If I query mysql with myPHPadmin directly with:
Code: Select all
UPDATE `db1`.`kundendaten` SET `accepted` = '1' WHERE `kundendaten`.`email` = [b] 'max-muster@hotmail.com[/b]' LIMIT 1;2) If I change the query in my PHP Code to:
Code: Select all
//Perform SQL query
$query = sprintf("UPDATE `db1`.`kundendaten` SET `accepted` = '1' WHERE `kundendaten`.[b]`email` = 'max-muster@hotmail.com' [/b]LIMIT 1;");
$query = sprintf($query);
mysql_query($query) or die ('Query failed: ' . mysql_error());3) If I echo ($query) from my base Code (at the top) with the $email = "max-muster@hotmail.com" it echoes:
Code: Select all
UPDATE `db1`.`kundendaten` SET `accepted` = '1' WHERE `kundendaten`.`email` = [b] 'max-muster@hotmail.com[/b]' LIMIT 1;...but if I copy and paste the echoed statement into a myPHPadmin query...it does work.
FUNNY QUIRK. It really drives me nuts.
Seems like it's not a MYSQL issue but some kind of PHP issue.
I spent the whole day searching for an answer but couldn't find any.
Hope someone can help me with this one. It's a tough nut to crack.