I have a google compute engine instance in which i create a mysql instance. I would like to know how I can connect to this instance from MySQL Workbench?
israel's questions
I would like to publish an application on the Play store as a company, but when creating an account it must be done as a personal account since it asks for a name, last name, date of birth, etc... My question is whether as a company it should be done different or what would be the recommendation? Is there a legal problem if I create an account and put the name of the company in the first and last name fields? I would not like my name to appear, but rather that of the company when they visit one of our Apps.
I have a PHP function to save data to DB. The data contains ñ and accents and that data is extracted from a third party page. I have tried many ways and it doesn't work.
This is the function I have:
public function agregarProduct($name,$brand,$price){
$sql ="CALL spAddProduct('$name','$brand',$precio);";
$result= $this->_BD->query($sql);
$resultado->close();
$this->_BD->next_result();
}
What I have tried is:
- Place header in the file indicating utf-8.
- I have used
$name = utf8_encode($name);
. - I have also used the function
mb_convert_encoding
. - Another one I used was
iconv(mb_detect_encoding($name, mb_detect_order(), true), "UTF-8", $name)
. - I have tried changing the DB collation to
utf8_general_ci
,utf8_spanish_ci
,uft8_default collation
. - Also in my connection I have used
$BD->query("SET NAMES 'utf8'");
and$BD->set_charset("utf8");
None of the above worked for me in the database. Since, for example, if it $name
comes in the argument Maíz
, it is saved in the database as Maíz
, but if I print it on the screen it appears fine (Corn).
I made an attempt placing by default a value $name
of the form $name = "Maíz";
so that it is correctly added to the database.
One difference I found is the following:
echo mb_detect_encoding($name = 'Maíz');
//esto devuelve UTF-8 y se ingresa correctamente a la BD
echo mb_detect_encoding($name); //$name viene como argumento de la funcion.
//esto devuelve ASCII y se ingresa con los caracteres raros
With this observation I wanted to see that it returned this same function when changing the variable with the functions utf8_encode
, mb_convert_encoding
and iconv
, the result for all was ASCII
.
How else could I solve this situation?