Instrucción update
Publicado por Pablo (39 intervenciones) el 14/03/2014 13:15:53
Hola amigos del foro: quería predirles una mano con la funcion update para editar database mysql. Basicamente con la form meto los datos utente y pass para encontrar la linea que me interesa y sobre el campo verifica con update debería cambiar el dato de uno a cero. Gracias por interesarse
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
$dbhost='xxxxxx';
$dbusername='xxxxxx';
$dbuserpass='xxxxxx';
$dbname='xxxxxx';
mysql_connect ($dbhost, $dbusername, $dbuserpass);
mysql_select_db($dbname) or die('Cannot select database');
if (isset($_POST['utente'])) {
$positivo= "1";
$negativo= "0";
$utente = $_POST['utente'];
$pass = $_POST['pass'];
$query = mysql_query("SELECT * FROM utente WHERE utente LIKE '%$utente%' and pass LIKE '%$pass%'");
$row = mysql_fetch_array($query);
$_SESSION['verifica'] = $row['verifica'];
$sql = mysql_query("UPDATE utente SET verifica = '".$negativo."' WHERE utente = '".$utente."', pass = '".$pass."', email = '".$_SESSION['verifica']."'");
}
?>
<html>
<head>
<style>
</style>
</head>
<body>
<div style="center: 0px; top: 2000px; ">
<form action="logino7.php" id="invia" name="invia" method="POST" >
</br></br></br></br></br></br></br></br></br></br></br></br>
<p><label>Email
<input type="text" id="utente" name="utente" value="" size="25" /></TD></label></p>
<p><label>Password <input type="password" id="pass" name="pass" value="" size="25" /></label></p>
<input type="submit" value="Invia"/>
</br></br>
</form>
</div>
</body>
</html>
Valora esta pregunta


0