Greetings, I have a problem with the following code, after trying I realized that something is happening with my variables that when I put them I stopped updating the data, I explain:
I have the following code that works perfect for me:
if ($boton == "Modificar"){
if ($cedula!=""){
$sql="update datosbasicos set CED_PAC=$cedula, NOM_PAC='$nombre', APE_PAC='$apellido',EDAD_PAC='$edad', HIS_PAC='$nhistoria', DIR_PAC='$direccion', TEL_PAC='$telefono', CEL_PAC='$celular', SEX_PAC ='$sexo' where CED_PAC='$cedula'";
mysql_query($sql);
echo "<script>alert('Datos modificados correctamente')</script>";
echo "<script>window.location='registro.php'</script>";
}
else{
echo "<script>alert('Para poder modificadar debe realizar una busqueda')</script>";
echo "<script>window.location='registro.php'</script>";
}
}
Now, I need to modify that code and add the following variables so that I can modify different fields of another table, it would look like this:
if ($boton == "Modificar"){
if ($cedula!=""){
$sql="UPDATE datosmedicos SET COD_CONSULTA='$codigo', ALT_PAC= '$altura', PESO_PAC='$peso', FECHA='$fecha', TIPO_CONSULTA='$tipconsulta', SINTOMAS='$sintomas', OBSERV='$observacion', HIS_PAC='$nhistoria', MEDI_PAC='$medicamentos', OPERADO='$operado', ALERGIAS='$alergias' where CED_PAC='$cedula'";
mysql_query($sql);
echo "<script>alert('Datos modificados correctamente')</script>";
echo "<script>window.location='consulta.php'</script>";
}
else{
echo "<script>alert('Para poder modificadar debe realizar una busqueda')</script>";
echo "<script>window.location='consulta.php'</script>";
}
}
This code no longer works for me, from the moment I put the first variable it stops working, although it tells me that it has been stored correctly, no change happens.
I do not think it's because I'm not working with MySQLi like they told me once, because then the first code would not work, I checked the database and the fields are correct. Does anyone have an answer?
Thank you very much.
EDIT
I show how I have declared the variables in case someone wants to see:
<?php
include('conexion.php');
$boton = $_POST["boton"];
$cedula = $_POST["CED_PAC"];
$nombre = $_POST["NOM_PAC"];
$apellido = $_POST["APE_PAC"];
$edad = $_POST["EDAD_PAC"];
$nhistoria = $_POST["HIS_PAC"];
$direccion = $_POST["DIR_PAC"];
$telefono = $_POST["TEL_PAC"];
$celular = $_POST["CEL_PAC"];
$sexo = $_POST["SEX_PAC"];
$codigo = $_POST["COD_CONSULTA"];
$fecha = $_POST["FECHA"];
$tipconsulta = $_POST["TIPO_CONSULTA"];
$observacion = $_POST["OBSERV"];
$sintomas = $_POST["SINTOMAS"];
$peso = $_POST["PESO_PAC"];
$altura = $_POST["ALT_PAC"];
$operado = $_POST["OPERADO"];
$alergias = $_POST["ALERGIAS"];
$medicamentos = $_POST["MEDI_PAC"];
DATABASE