a13293 Posted March 19, 2008 Report Share Posted March 19, 2008 boas,é o seguinte estou a tentar fazer o update de uma tabela da base dados mas mas quando tento inserir este texto <strong>coordenadas GPS: <br> lat: N 41º 26' 55'' <br> long: W 8º 18' 2.8'' <p> que sao as coordenadas gps da erro por causa dos caracteres '' e '. if ($op == 'form_ok') { $titulo = $_POST['titulo']; $morada = $_POST['morada']; $telefone = $_POST['telefone']; $fax = $_POST['fax']; $gps = $_POST['c_gps']; //alterei aqui $sql_update = "UPDATE contactos SET titulo='$titulo', morada='$morada', telefone='$telefone', fax='$fax',gps='$gps' WHERE id=1"; $sql_update = "UPDATE contactos SET titulo='$titulo', morada='$morada', telefone='$telefone', fax='$fax', gps='$gps' WHERE id=1"; mysql_query($sql_update, $ligacao) or die("erro"); echo "<span class=\"txtNorm\">contactos editados com sucesso </span>"; } sera que alguem pode ajudar.. obrigado. 1011 Link to comment Share on other sites More sharing options...
cyclop Posted March 19, 2008 Report Share Posted March 19, 2008 faz escape das aspas e/ou plicas "Quando eu for grande quero ser como o Celso" Link to comment Share on other sites More sharing options...
a13293 Posted March 19, 2008 Author Report Share Posted March 19, 2008 ok ja resolvi... aqui fica o codigo correcto. if ($op == 'form_ok') { $titulo = $_POST['titulo']; $morada = $_POST['morada']; $telefone = $_POST['telefone']; $fax = $_POST['fax']; $gps=addslashes($_POST['c_gps']); //alterei aqui $sql_update = "UPDATE contactos SET titulo='$titulo', morada='$morada', telefone='$telefone', fax='$fax',gps='$gps' WHERE id=1"; $sql_update = "UPDATE contactos SET titulo='$titulo', morada='$morada', telefone='$telefone', fax='$fax', gps='$gps' WHERE id=1"; mysql_query($sql_update, $ligacao) or die("erro"); echo "<span class=\"txtNorm\">contactos editados com sucesso </span>"; } 1011 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now