me sale un error al guardar en la base datos php y mysql
Publicado por Reynaldo (7 intervenciones) el 27/04/2017 18:31:47
me sale este error en xammp localmente
Warning: mysqli_query() expects at least 2 parameters, 1 given in C:\xampp\htdocs\prueba\compras\compras.php on line 34
Error:
Warning: mysqli_query() expects at least 2 parameters, 1 given in C:\xampp\htdocs\prueba\compras\compras.php on line 34
Error:
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
<?php
session_start();
include 'conexion.php';
$arreglo=$_SESSION['carrito'];
$numeroventa=0;
$re=mysqli_query("select * from compras order by numeroventa DESC limit 1") or die(mysqli_error());
while ( $f=mysqli_fetch_array($re)) {
$numeroventa=$f['numeroventa'];
}
if($numeroventa==0){
$numeroventa=1;
}else{
$numeroventa=$numeroventa+1;
}
for($i=0; $i<count($arreglo);$i++){
// me sale un error no me guarda en la base datos
mysqli_query("insert into compras (numeroventa, imagen,nombre,precio,cantidad,subtotal) values(
".$numeroventa.",
'".$arreglo[$i]['Imagen']."',
'".$arreglo[$i]['Nombre']."',
'".$arreglo[$i]['Precio']."',
'".$arreglo[$i]['Cantidad']."',
'".($arreglo[$i]['Precio']*$arreglo[$i]['Cantidad'])."'
)")or die('Error:'.mysqli_error($link));
}
unset($_SESSION['carrito']);
header("Location: ../admin.php");
?>
Valora esta pregunta
0