0
The problem is this, I have an editing form whose data is sent by ajax
. Here’s the code:
$("#edit_rua").click(function(){
var id = $(this).attr("data-id");
var nome = $("#nome_rua2").val();
var cod = $("#cod_rua").val();
$.ajax({
type: "POST",
url: "cod_ajax/muda_rua.php",
data: "id="+id+"&nome1="+nome+"&cod="+cod,
success: function(e){
alert(e);
$(".nome"+id).html(nome);
$(".cod"+id).html(cod);
}
})
});
I gave a alert()
in the nome
, I gave him a alert
within the muda_rua.php
, returns well, however, whenever it gives the UPDATE
, it does not update, just returns 0
, and if I type 1
, he inserts 1
.
Here is the code of muda_rua.php
<?php
require "ligacao_bd.php";
$nome=$_POST['nome1'];
$cod=$_POST['cod'];
echo $nome;
$insert=mysql_query("UPDATE nome_tabela SET nome = '$nome' AND cod_postal = '$cod' where id = '".$_POST['id']."'") or die("ERRO 1!!!");
?>
It does not give the error of mysql_error()
, and if I remove the field from the name of UPDATE
, it updates the postcode.
I know that the
mysql
isdeprecated
but the old programmer used it and he has over 100 pages using it.
Thank you! It worked, I will give your reply as accepted soon. I could explain why it did not give error in
mysql
?– I_like_trains
@I_like_trains this gives error or can not be some configuration on
PHP
.– novic