porque no me cambia los datos de mi tabla?
Publicado por hola1 (30 intervenciones) el 22/10/2020 02:49:19
me devuelve a la pagina, pero los dato no se cambian ¿Por qué es? ayuda pliss
SESSION.PHP
SAVEEDIT.PHP
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<?php include('session.php'); ?>
<?php
$query = $conn->query("select * from user where id_user = '$session_id'");
$row = $query->fetch();
$id = $row['id_user'];
?>
<h1 class="title">Editar Mi Perfil</h1>
<form method="post" action="perfilPhp/save_edit.php">
<input type="hidden" name="id_user" value="<?php echo $id; ?>">
<h3 id="imgPer">Imagen del perfil</h3>
<img class="userImgEdit" src="<?php echo $image; ?>" height="140" width="160">
<div class="divofdiv">
<p id="tf1">Cambiar imagen</p>
<input type="file" id="caraI" accept="img/*">
</div>
<h3 id="nameUser">Nombre de usuario</h3>
<input type="text" name="username" class="nameEdit" value="<?php echo $row['username']; ?>">
<h3 id="email">Correo electronico</h3>
<input type="text" id="emailI" class="emailEdit" name="email" value="<?php echo $row['email']; ?>">
<h3 id="pass">Contraseña</h3>
<input type="text" id="passI" class="passEdit" name="password" value="<?php echo $row['password']; ?>">
<button name="save" id="SaveC" class="btn edit">Guardar cambios</button>
SESSION.PHP
1
2
3
4
5
6
7
8
9
10
11
<?php
session_start();
if (!isset($_SESSION['id'])){
header('location:index.html');
}
$session_id = $_SESSION['id'];
$session_query = $conn->query("select * from user where id_user = '$session_id'");
$user_row = $session_query->fetch();
$username = $user_row['nombre']." ".$user_row['lastname'];
$image = $user_row['image'];
?>
SAVEEDIT.PHP
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<?php
include('conP.php');
$member_id = $_POST['id_user'];
$username = $_POST['username'];
$email = $_POST['email'];
$password = $_POST['password'];
$conn->query("update user set username = '$username',email = $email,password = $password where id_user = '$member_id'");
?>
<script>
window.location = '../perfilEdit.php<?php echo '?id='.$member_id; ?>';
</script>
Valora esta pregunta


0