I do a SQL query, problems with the coding.

$s = "SELECT SUM( `square` ) FROM `reports` WHERE `username` = '$arr[$i]';" 

The request does not work. Base in utf-8, script in win-1251.

phpMyAdmin only understands when so

 SELECT SUM( `square` ) FROM `reports` WHERE `username` = 'Eaai' 

How to do it in a script?

  • @ Anna, To format the code, select it with the mouse and click on the button 101010 of the editor. - Nicolas Chabanovsky

2 answers 2

And setting the encoding of the request does not help?

 query("SET NAMES UTF8"); 
  • No, it did not help .. - Anna
 $s = "SELECT SUM(`square`) FROM `reports` WHERE `username` = '".$arr[$i]."';" 
  • the query goes like this SELECT SUM ( square ) FROM reports WHERE username = 'Ivan' phpAdmin understands only when so SELECT SUM (square) FROM reports WHERE username = 'Eaai' (( - Anna