PHP - cambiar Query a Mysqli

 
Vista:
sin imagen de perfil
Val: 4
Ha aumentado su posición en 19 puestos en PHP (en relación al último mes)
Gráfica de PHP

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
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
Val: 1.071
Bronce
Ha mantenido su posición en PHP (en relación al último mes)
Gráfica de PHP

cambiar Query a Mysqli

Publicado por Yamil Bracho (888 intervenciones) el 29/03/2016 04:03:45
Solo debes agregar "i" a la instrucción . te quedaria algo como :

mysqli_query("INSERT INTO productos (pedido,origen,destino,transporte,equipo,ft,tarimas,fecha_reg)VALUES('$pedido','$origen','$destino','$transporte','$equipo','$ft','$tarimas','$fecha')");
break;
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