简体   繁体   中英

UPDATE MySQL is not working with PHP

I got a problem with my code and I don't know why it is not working, I hope you can help me, the code looks fine but is not updating the records, some ideas?

<?php
$folio = $_POST['folio'];
$nombre = $_POST['nombre'];
$fecha = $_POST['fecha'];
$link = mysqli_connect("localhost", "user", "pass", "database") 
or die("Error en la conexion: " . mysqli_error($link));

// Printing variables to check out everything is ok

echo $folio . '<br />';
echo $nombre . '<br />';
echo $fecha . '<br />';
$consulta = mysqli_query($link, "UPDATE solicitudes SET folio = '$folio',
            nombre = '$nombre',fecha = '$fecha'
            WHERE folio = '$folio'") or die("Error: " . mysql_error());

if ($consulta)
    {
    echo "it's working";
    }
  else
    {
    echo "is not working";
    }

?>

check the following:-

$con = mysql_connect("localhost","user","pass"); if (!$con) { die('Could not connect: ' . mysql_error()); }

mysql_select_db("databse",$con); mysql_query("UPDATE solicitudes SET folio = '$folio',nombre ='$nombre',fecha = '$fecha'WHERE folio = '$folio'")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM