PHP - Como actualizar una imagen ya subida a Msql

 
Vista:

Como actualizar una imagen ya subida a Msql

Publicado por Raul (1 intervención) el 03/08/2021 23:55:33
Muy buenas amigos, si me pudieran ayudar en actualizar la foto que ya subo de un cliente. soy nuevo y estoy aprendiendo, filefoto es el nombre de la columna donde se guarda la imagen en la base de datos. Este es mi codigo:

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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
Reemplace este texto
<?php
 
include "conexion.php"; // Using database connection file here
 
$id = $_GET['ID']; // get id through query string
 
$qry = mysqli_query($db,"select * from datausuarios where ID='$id'"); // select query
 
$data = mysqli_fetch_array($qry); // fetch data
 
if(isset($_POST['update']))
{
 
	$clave = $_POST['clave'];
	$nombre = $_POST["nombre"];
	$correo = $_POST['correo'];
	$cedula = $_POST["cedula"];
	$direccion = $_POST["direccion"];
	$tel = $_POST["tel"];
	$productos = $_POST["productos"];
	$precioini = $_POST["precioini"];
	$preciocre = $_POST["preciocre"];
	$cuotaqui = $_POST["cuotaqui"];
	$preciocom = $_POST["preciocom"];
	$fechaven = $_POST["fechaven"];
	$numcuotas = $_POST["numcuotas"];
	$fechapri = $_POST["fechapri"];
	//$foto = $_POST["filefoto"];
 
    $actualiza = mysqli_query($db,"update datausuarios set nombre='$nombre', clave='$clave' where ID='$id'");
 
 
    if($actualiza)
    {
        mysqli_close($db); // Close connection
		echo '<div class="registroEx animate__animated animate__fadeInLeft">Registro editado</div>';
    }
    else
    {
        echo mysqli_error();
    }
 
}
 
?>
 
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script>(function(e,t,n){var r=e.querySelectorAll("html")[0];r.className=r.className.replace(/(^|\s)no-js(\s|$)/,"$1js$2")})(document,window,0);</script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css">
<link rel="stylesheet" type="text/css" href="reset.css">
<link rel="stylesheet" type="text/css" href="estilo.css">
 
 
<a href="vistaGral.php"><span class="icon-undo2"></span></a>
 
 
	<!--Mostrar acá todos los datos -->
 
 
	<div style="width: 100%; text-align: center;">
 
		<h1 class="editmargin">EDITAR REGISTRO</h1><br><br>
 
		<div class="ingreso">
 
		       <form action = "" method="POST">
 
			   <div class="subFoto cursor cargarFoto">
 
			<img id="fotoCliente" src="#"/>
 
				 <img style="margin: 25px auto 0;" src="img/foto.svg">
 
				 </div>
 
				 <input class="" type="file" name="foto" value="<?php echo $data['filefoto'] ?>"/>
 
				<div class="bloque">
				<h3>CLAVE:</h3>
				<input type="text" name="clave" id="clave" value="<?php echo $data['clave'] ?>" Required>
				</div>
 
				<div class="bloque">
				<h3>NOMBRE COMPLETO:</h3>
				<input type="text" name="nombre" id="nombre" value="<?php echo $data['nombre'] ?>" Required>
				</div>
 
				<div class="bloque">
				<h3>CORREO:</h3>
				<input type="text" name="correo" id="correo" value="<?php echo $data['correo'] ?>" Required>
				</div>
 
				<div class="bloque">
				<h3>CÉDULA:</h3>
				<input type="text" name="cedula" id="cedula" value="<?php echo $data['cedula'] ?>" Required>
				</div>
 
				<div class="bloque">
				<h3>DIRECCIÓN:</h3>
				<input type="text" name="direccion" id="direccion" value="<?php echo $data['direccion'] ?>" Required>
				</div>
 
				<div class="bloque">
				<h3>TELÉFONO::</h3>
				<input type="number" name="tel" id="tel" value="<?php echo $data['tel'] ?>" Required>
				</div>
 
				<div class="bloque">
				<h3>PRODUCTO:</h3>
				<input type="text" name="productos" id="productos" value="<?php echo $data['productos'] ?>" Required>
				</div>
 
			 	<div class="bloque">
				<h3>INICIAL:</h3>
				<input type="number" name ="precioini" id="precioini" value="<?php echo $data['precioini'] ?>" Required>
				</div>
 
				<div class="bloque">
				<h3>PRECIO DE CRÉDITO:</h3>
				<input type="number" name ="preciocre" id="preciocre" value="<?php echo $data['preciocre'] ?>" Required>
				</div>
 
				<div class="bloque">
				<h3>CUOTA QUINCENAL:</h3>
				<input type="number" name ="cuotaqui" id="cuotaqui" value="<?php echo $data['cuotaqui'] ?>" Required>
				</div>
 
				<div class="bloque">
				<h3>PRECIO DE COMPRA:</h3>
				<input type="number" name ="preciocom" id="preciocom" value="<?php echo $data['preciocom'] ?>" Required>
				</div>
 
				<div class="bloque">
				<h3>FECHA DE VENTA:</h3>
				<input type="date" name ="fechaven" id="fechaven" value="<?php echo $data['fechaven'] ?>" Required>
				</div>
 
			 	<div class="bloque">
				<h3>CUOTAS:</h3>
				<input type="number" name ="numcuotas" id="numcuotas" value="<?php echo $data['numcuotas'] ?>" Required>
				</div>
 
			 	<div class="bloque">
				<h3>FECHA PRIMERA CUOTA:</h3>
				<input type="date" name ="fechapri" id="fechapri" value="<?php echo $data['fechapri'] ?>" Required>
				</div>
 
		<input id="enviar" style="margin: 0 auto; display: block;" class="pago btnVer" type="submit" name="update" value="Actualizar">
 
			  </form>
		</div>
	</div>
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
sin imagen de perfil

Como actualizar una imagen ya subida a Msql

Publicado por Raul (1 intervención) el 06/08/2021 18:39:06
Si alguien puede ayudarme por favor, algún programador php si puede contactarme a [email protected] puedo pagar si es necesario. ya que tengo varias cosas que resolver y así llegamos a algún acuerdo. Gracias de ante manos.
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