1
I am using the following code to insert a quoted text into a mysql database:
mysqli_query($con, "insert into medicacaohistorico (data, unidadeori, unidadedes, itemdetalhe, qtd, solicitante, despachante) values ('".date("y-m-d")."', '".$nome = mysqli_real_escape_string($con, $usuario['unidade'])."', '".$unidadeDes."', '".substr($dados[$i], 1)."', '".$dados[$i + 1]."', '".$solicitante."', '".$despachante."')")
I learned to use the mysqli_real_escape_string
but the same is not working.
The unsaved string is:
insert into medicacaohistorico (data, unidadeori, unidadedes, itemdetalhe, qtd, solicitante, despachante) values ('18-08-08', '5', '0', '12', '1', 'DAMIAO', 'MEDICO CAIXA D'AGUA')
right, but how to do that when I get the string like this
$usuario['unidade']
?– Italo Rodrigo
By its query, who has the quote character is the dispatcher and not unit, is last value in
values
, then basically it would be like this, for example:$despachante = real_escape_string($usuario['despachamte']);
– Ricardo Pontual
Therefore, that’s right, the dispatcher is the unit, so I confuse. grateful there
– Italo Rodrigo