What would be added from the database without hieroglyphs:

mysqli_query ($db, 'set character_set_results = "utf8"'); 

Here is the connection to the database itself:

 $db = mysqli_connect ("localhost", "stretchc_admin", "5616456164", "stretchc_db"); 

Everything works but errors are displayed:

Notice: Undefined variable: db in /home/stretchc/public_html/resources/php/db.php on line 2

Warning: mysqli_query () expects parameter 1 to be mysqli, null given in /home/stretchc/public_html/resources/php/db.php on line 2

How to get rid of errors?

  • mysqli_query () you have just in db.php and on the second line? - Vladimir Martyanov
  • @ Vladimir Martiyanov It goes before db as if to put after that the hieroglyphs are shown - idon
  • one
    Seriously? do you give null to the input and everything works? Magic - Aleksey Shimansky
  • @ AlekseyShimansky Yes, there are no problems with the output, but if you put after the announcement, that is, stretch-ceilings.by , Identical

1 answer 1

Try instead of your option to stick to the beginning of the file

 mysqli_query($db, "SET NAMES 'utf8'"); 
  • All good but this one appeared: Warning: mysqli_query () expects at least 2 parameters, 1 given in /home/stretchc/public_html/resources/php/db.php on line 2 - Identon
  • All the same mistake - idon
  • Strangely, the error is that mysqli_query expects 2 parameters, but you have them and so 2. Maybe you have an inappropriate version of php or mysql? - luckydutch
  • No, maybe the fact is that I set the encoding earlier than I set the connection with the database in the variable, but otherwise it does not work, it shows the hieroglyphs - idon
  • Solved the problem? How? You would also check the encoding of your database, table, table fields. It must be the same everywhere. - luckydutch