PHP - actualizar datos en mysql

 
Vista:

actualizar datos en mysql

Publicado por daniel becerra lizarraga (16 intervenciones) el 11/05/2006 21:49:19
hola grupo he tenido un problema para actualizar los datos de mi bd.
y es que nesesito que la actualizacion de la hora se automatica.

<html>
<head>
<title>Consultar Usuario</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body> <center>
<?php
$enviar=$_GET['enviar'];
$compu=$_GET['compu'];

if ($enviar){
$conecion=mysql_connect("localhost","root","") or die ("No es fue posibles efectuar la conexi�..");
$db=mysql_select_db("ciber", $conecion) or die ("No se pudo seleccionar una base de datos...");

/*al parecer el error es por esto--->*/$hora=date("H:i");
$query0="UPDATE nuevoU SET horafin=$hora WHERE compu=$compu and total=0";
$result0=mysql_query($query0) or die ("Consulta fallida : ".mysql_error());

$query = "SELECT * FROM nuevoU WHERE compu=$compu ORDER BY fecha DESC";
$result=mysql_query($query) or die ("Consulta fallida : ".mysql_error());

echo "<table border=1>";
echo "<tr>";
echo "<th>Nombre</th><th>Computadora</th><th>Fecha</th><th>Hora inicio</th><th>Hora fin</th><th>Total a pagar</th>";
while ($row =mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>", $row ['nombre'],"</td><td>", $row['compu'],"</td><td>", $row['fecha'],"</td><td>", $row['horaini'],"</td><td>",$row['horafin'],"</td><td>", $row['total'],"</td>";
}
echo "</table>";
mysql_close($conecion);
}else{?>
<form name="form1" method="get" action="consul.php">
<br>
Numero de Computadora<input type="text" name="compu">
<br>
<br>
<input type="submit" name="enviar" value="Consultar">
</form>
<?php }?>
</center>
</body>
</html>
este es el error que manda:
Consulta fallida : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ':39 WHERE compu=11 and total=0' at line 1
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:actualizar datos en mysql

Publicado por daniel becerra lizarraga (16 intervenciones) el 12/05/2006 18:11:25
sole faltaba la '$hora' :
$query0="UPDATE nuevoU SET horafin='$hora' WHERE compu=$compu and total=0";
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar