cambiar Query a Mysqli
Publicado por manuel (4 intervenciones) el 29/03/2016 03:27:24
Hola quien me ayuda para cambiar la consulta (query )a mysqli que estan en el swich.
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
<?php
include('conexion.php');
$id = $_POST['id-prod'];
$proceso = $_POST['pro'];
$pedido=$_POST['pedido'];
$origen=$_POST['origen'];
$destino=$_POST['destino'];
$transporte=$_POST['transporte'];
$equipo=$_POST['equipo'];
$ft=$_POST['ft'];
$tarimas=$_POST['tarimas'];
$fecha = date('Y-m-d');
//VERIFICAMOS EL PROCESO
switch($proceso){
case 'Registro':
mysql_query("INSERT INTO productos (pedido,origen,destino,transporte,equipo,ft,tarimas,fecha_reg)VALUES('$pedido','$origen','$destino','$transporte','$equipo','$ft','$tarimas','$fecha')");
break;
case 'Edicion':
mysql_query("UPDATE productos SET pedido= '$pedido',origen = '$origen',destino = '$destino',transporte = '$transporte',equipo = '$equipo',ft ='$ft',tarimas = '$tarimas' WHERE id_prod = '$id'");
break;
}
//ACTUALIZAMOS LOS REGISTROS Y LOS OBTENEMOS
$sql= "SELECT * FROM productos ORDER BY id_prod ASC";
$result= $conn->query($sql);
//CREAMOS NUESTRA VISTA Y LA DEVOLVEMOS AL AJAX
echo '<table class="table table-striped table-condensed table-hover">
<tr>
<th width="100">Pedido</th>
<th width="100">Origen</th>
<th width="100">Destino</th>
<th width="150">Transporte</th>
<th width="150">Equipo </th>
<th width="100">ft</th>
<th width="100">Tarimas</th>
<th width="50">Opciones</th>
</tr>';
while($registro2 = $result-> fetch_assoc()){
echo '<tr>
<td>'.$registro2['pedido'].'</td>
<td>'.$registro2['origen'].'</td>
<td>'.$registro2['destino'].'</td>
<td>'.$registro2['transporte'].'</td>
<td>'.$registro2['equipo'].'</td>
<td> ft/.'.$registro2['ft'].'</td>
<td>'.$registro2['tarimas'].'</td>
<td><a href="javascript:editarProducto('.$registro2['id_prod'].');" class="glyphicon glyphicon-edit"></a> <a href="javascript:eliminarProducto('.$registro2['id_prod'].');" class="glyphicon glyphicon-remove-circle"></a></td>
</tr>';
}
echo '</table>';
?>
Valora esta pregunta


0