Error making UPDATE

-1
<html> 
<head> 
<title>Actualizacion completada.</title> 
</head> 
<body> 

<?php 

$docu = $_POST['docu']; 
$apat = $_POST['apat']; 
$amat = $_POST['amat']; 
$nomb = $_POST['nomb']; 
$corr = $_POST['corr']; 

echo "$docu";
// Actualizamos en funcion del id que recibimos
$base = "hcc";  
$tabla = "members";
$user = "xxxx";
$pasw = "yy" ; 

$enlace =  mysql_connect('localhost',$user,$pasw);
echo mysql_errno($enlace) . ": " . mysql_error($enlace). "\n";
echo "<br>"; 

$bdatabase = mysql_select_db('hcc', $enlace);
echo mysql_errno($enlace) . ": " . mysql_error($enlace). "\n";
echo "<br>" 

//mysql_query("UPDATE 'members' SET 'a_pat'='$apat' ", $enlace) or die (mysql_error()); 
$ssql = "UPDATE $tabla SET a_pat='$apat' WHERE doc='$docu' ";
$resultUpdat = mysql_query($sql); 
//$resultUpdate = mysqli_query($enlace, $ssql); 
 if($resultUpdate)
         {
            echo "<strong>El actualizo el registro ID ".$_POST['docu']." con exito</strong>. <br>";
         }
         else
         {
            echo "No se pudo actualizar el registro. <br>";
         }
//mysql_query($queryUpdate); 

mysql_close($enlace); 

echo " 

"; 

?> 

<p>Los datos han sido actualizados con exito.</p> 

<p><a href='edicion.html'>RETORNO INICIO</a></p> 
</body> 

</html>
    
asked by hcc 07.09.2017 в 04:47
source

1 answer

1

It seems to me that the error you will be giving you is due to the fact that you are using "mysql_connect" on one side to make the connection string and then "mysqli" to perform the processing of the queries. These two methods are not compatible. If you want everything to work for you, you should change to use "mysql" to do the whole process or "mysqli" for the same thing.

I leave here the code for you to do everything with "mysqli"

//Cadena de conexión
$con=mysqli_connect($hos_name, $user_name, $password, $database);

//Procesado de la consulta
$consulta="SELECT * FROM TABLA";
$resultado=$con->query($consulta);
$fila=$resultado->fetch_array();
    
answered by 07.09.2017 в 15:52