mysql_query et CREATE FUNCTION
Bonjour,
Bien que la requête soit correct (tester sous Navicat), il n'est pas possible de l’exécuter sous PHP avec mysql_query.
Voici la requête en question:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13
|
SET NAMES utf8;
CREATE FUNCTION translate(V_string VARCHAR(255), V_from VARCHAR(255), V_to VARCHAR(255))
RETURNS VARCHAR(255) DETERMINISTIC
BEGIN
DECLARE i INT;
SET i = CHAR_LENGTH(V_from);
WHILE i > 0 DO
SET V_string = REPLACE(V_string, SUBSTR(V_from, i, 1), SUBSTR(V_to, i, 1));
SET i = i - 1;
END WHILE;
RETURN UPPER(V_string);
END; |
Voici l'erreur retourné sous PHP:
Citation:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CREATE FUNCTION translate(V_string VARCHAR(255), V_from VARCHAR(255), V_to VARCH' at line 2
Merci