
intento guardar a la base datos y me sale error
Publicado por Reynaldo (7 intervenciones) el 28/04/2017 15:34:52
Error:You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz??????????????????????????????????????' at line 1
en phpmyadmin
en phpmyadmin
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
<?php
session_start();
include '../conexion.php';
$arreglo=$_SESSION['carrito'];
$numeroventa=0;
$link = mysqli_connect("localhost", "root","","carrito de compras");
mysqli_select_db($link, "carrito de compras");
$tildes = $link->query("SET NAMES 'utf8'"); //Para que se muestren las tildes correctamente
$re = mysqli_query($link, "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++){
if($arreglo[$i] !=NULL){
$imagen = $arreglo[$i]['Imagen'];
$nombre = $arreglo[$i]['Nombre'];
$precio = $arreglo[$i]['Precio'];
$cantidad = $arreglo[$i]['Cantidad'];
mysqli_query($link,"insert into compras (numeroventa, imagen,nombre,precio,cantidad) values('$numeroventa','$imagen','$nombre','$precio','$cantidad' )")
or die('Error:'.mysqli_error($link));
}
}
unset($_SESSION['carrito']);
header("Location:../admin.php");
?>
Valora esta pregunta


0