Tema: Update
Ver Mensaje Individual
  #1 (permalink)  
Antiguo 03/10/2010, 19:35
avargasc1
 
Fecha de Ingreso: abril-2009
Mensajes: 29
Antigüedad: 15 años, 10 meses
Puntos: 0
Update

Estoy aprendiendo PHP y Mysql, pero no he podido pasar de el ejercicio de actualizar una tabla:

Tengo el siguiente codigo:

<?php
$con = mysql_connect("localhost","root","pswroot");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("php2",$con);

$my_sql="UPDATE logins SET username = 'wjgilmore', SET pswd = '098f6bcd4621d373cade4e832627b4f6'";
$Sql_upd= mysql_query($my_sql,$con);
if(! $Sql_upd)
{
die('Error en Update:'.mysql_error());
}
echo "Updated Ok\n";

mysql_close($con);
?>

Me arroja el siguiente error:

Could not update data: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 'SET pswd = '098f6bcd4621d373cade4e832627b4f6'' at line 1

igualmente lo hize directamente en Mysql de la siguiente manera:

UPDATE logins
Set username = ´wjgilmore´,
Set pswd = ´098f6bcd4621d373cade4e832627b4f6´;

y tampoco funciona.

Esta es la tabla:

CREATE TABLE logins (
id TINYINT UNSIGNED NOT NULL AUTO_INCREMENT,
username VARCHAR(16) NOT NULL,
pswd VARCHAR(32) NOT NULL,
PRIMARY KEY(id));