Field with Cedilla in Mysql

0

I have a field in my database table MySql with the name 'description', with special accents.

My problem is: When I make a INSERT INTO directly using phpMyAdmin , it normally inserts the information into the table, but when using mysql it returns the following error.

This is my sql code:

INSERT INTO caixa_geral_dc (
descrição,
empresa,
valor_c_d,
conta,
categoria,
d_c,
usuario)
VALUES 
('GUARDA PROVISÓRIA DE VALORES',
'$nome_cliente[$i]',
'$v_recebido&[$i]',
'7',
'197',
'c',
'$_SERVER[nomeUsuario]')

I await answers.

Thank you

    
asked by anonymous 11.05.2017 / 19:16

3 answers

2

When you have some field with special characters or blanks in it, this field should be declared within ''

Here's how your query should look:

INSERT INTO caixa_geral_dc ( 'descrição', empresa, valor_c_d, conta, categoria, d_c, usuario) VALUES ('GUARDA PROVISÓRIA DE VALORES', '$nome_cliente[$i]', '$v_recebido&[$i]', '7', '197', 'c', '$_SERVER[nomeUsuario]') 
    
11.05.2017 / 19:26
3
___ erkimt ___ Field with Cedilla in Mysql ______ qstntxt ___

I have a field in my database table MySql with the name 'description', with special accents.

My problem is: When I make a %code% directly using phpMyAdmin , it normally inserts the information into the table, but when using mysql it returns the following error.

Thisismysqlcode:

INSERTINTOcaixa_geral_dc('descrição',empresa,valor_c_d,conta,categoria,d_c,usuario)VALUES('GUARDAPROVISÓRIADEVALORES','$nome_cliente[$i]','$v_recebido&[$i]','7','197','c','$_SERVER[nomeUsuario]')

Iawaitanswers.

Thankyou

    
______azszpr203983___

When you have some field with special characters or blanks in it, this field should be declared within ''

Here's how your query should look:

INSERT INTO caixa_geral_dc ( 'descrição', empresa, valor_c_d, conta, categoria, d_c, usuario) VALUES ('GUARDA PROVISÓRIA DE VALORES', '$nome_cliente[$i]', '$v_recebido&[$i]', '7', '197', 'c', '$_SERVER[nomeUsuario]')
    
______ ___ azszpr203980

Put the name of your field between 'to signal that it is a field (this also serves to restricted names and / or spaces)

%pre%     
______ azszpr204013 ___

Galera. Thanks everyone for the help, but I solved my problem. Just add the line

mysql_set_charset ('utf8');

in the connection.php file to work.

Remembering that adding the crass before description also solved the problem.

It looks like this:

Thank you messssmo! See you! : D

    
___
11.05.2017 / 19:18
1

Galera. Thanks everyone for the help, but I solved my problem. Just add the line

mysql_set_charset ('utf8');

in the connection.php file to work.

Remembering that adding the crass before description also solved the problem.

It looks like this:

Thank you messssmo! See you! : D

    
11.05.2017 / 20:25