
Error en servidor, en local funciona correctamente
Publicado por Fernando (2 intervenciones) el 28/04/2015 16:45:03
código en un carrito de compra que me funciona correctamente en local (xampp) pero no en el servidor cuando lo subo. Me da el siguiente error: Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /usr/home/ibizaenelcorazon.com/web/carritocliente.php on line 52
mi código es el siguiente:
Alguien puede ayudarme?... le quedaría eternamente agradecido!!
mi código es el siguiente:
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
<?php
session_start();
require_once('Connections/ibiza.php');
if(isset($_SESSION['carrito'])){
if(isset($_GET['id'])){
$arreglo=$_SESSION['carrito'];
$encontro=false;
$numero=0;
for($i=0;$i<count($arreglo);$i++){
if($arreglo[$i]['id']==$_GET['id']){
$encontro=true;
$numero=$i;
}
}
if($encontro==true){
$arreglo[$numero]['Cantidad']=$arreglo[$numero]['Cantidad']+1;
$_SESSION['carrito']=$arreglo;
}else{
$nombre="";
$precio=0;
$imagen="";
$var=$_GET['id'];
$re=mysql_query("select * from tblproduct where idProduct=".$_GET['id']);
while ($f=mysql_fetch_array($re)) {
$nombre=$f['strProduct'];
$precio=$f['dblOffprice'];
$imagen=$f['strImage'];
}
$datosNuevos=array('id'=>$_GET['id'],
'strProduct'=>$nombre,
'dblOffprice'=>$precio,
'strImage'=>$imagen,
'Cantidad'=>1);
array_push($arreglo, $datosNuevos);
$_SESSION['carrito']=$arreglo;
}
}
}
else{
if(isset($_GET['id'])){
$nombre="";
$precio=0;
$imagen="";
$re=mysql_query("select * from tblproduct where idProduct=".$_GET['id']);
while ($f=mysql_fetch_array($re)) {
$nombre=$f['strProduct'];
$precio=$f['dblOffprice'];
$imagen=$f['strImage'];
}
$arreglo[]=array('id'=>$_GET['id'],
'strProduct'=>$nombre,
'dblOffprice'=>$precio,
'strImage'=>$imagen,
'Cantidad'=>1);
$_SESSION['carrito']=$arreglo;
}
}
?>
Alguien puede ayudarme?... le quedaría eternamente agradecido!!
Valora esta pregunta


0