0

I have the following mysqli prepare statement:

$incity = "%{$mysqli->real_escape_string($city)}%";
$instreet = $mysqli->real_escape_string($street);
$incp = "%{$mysqli->real_escape_string($cp)}%";

$mysqli->prepare("SELECT zonasrepartoid, calle, municipio, codigopostal FROM zonasreparto WHERE municipio like ? AND levenshtein(?, calle) BETWEEN 0 AND 6 AND codigopostal like ?")

$stmt->bind_param('sss',$incity,$instreet,$incp);
$stmt->execute();

My problem is that the levenshtein function doesnt return any result, and i have tried and look for anything, but i dont know what else to do.

thank you in advance!

Your Common Sense
  • 156,878
  • 40
  • 214
  • 345
myhappycoding
  • 648
  • 7
  • 20
  • Do you get any errors? – kero May 26 '14 at 20:45
  • That's very confusing looking. At you trying to search some raw PHP code that's embedded in the database? – Marc B May 26 '14 at 20:45
  • i dont get errors, and i have executed the query in the database and it works. I think my problem is that i am writing wrong the syntax because i am under PHP, but not sure really – myhappycoding May 26 '14 at 20:50
  • Okay, if thats the case then print the actual query on your php page once its prepared. See what exactly is being fired upon the database word to word. That should tell whats going wrong with it & where. – Bhrugesh Patel May 26 '14 at 21:06
  • @user2762365 This answer might help http://stackoverflow.com/questions/10803864/mysql-which-hash-algo-should-i-use-for-this/10804695#10804695 – Lawrence Cherone May 26 '14 at 21:15
  • If you're using placeholders and `bind_param`, then the escape calls are redundant and are probably mangling your data. – tadman May 26 '14 at 21:43
  • Thanks Loz Cherone, but i have tried that before and i still dont get any result. The thing is that the query works perfectly well, but from my php code it doesnt. – myhappycoding May 27 '14 at 08:31

1 Answers1

0

I think that my problem is that i cant execute functions because i get the next message:

Fallo en la obtencion de resultados: () execute command denied to user 'sec_user'@'localhost' for routine 'database.levenshtein'

I hope to help to someone with the same error

myhappycoding
  • 648
  • 7
  • 20