Problemas al mostrar un div con bases de datos
Publicado por monica3sys (1 intervención) el 14/12/2013 08:01:10
Buenas noches, hice una base de datos con productos y subproductos en la tabla subproductos tengo tres campos para 3 fotos cuando le doy clic en algun subproducto y si me falta una foto me muestra el div con un icono y no quiero eso si no que no muestre ese div
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
<?php
require_once("clases/clas.php");
$tra=new trabajo();
$con=mysql_connect("localhost", "root", "");
mysql_query("SET NAMES 'utf8'");
mysql_select_db("disparcol");
if (isset($_GET["id"]))
{
$sql="select
p.cod_foto
from
productos as p
where
p.cod_sub=".$_GET["id"]."
";
//echo "$sql";
}else
{
$sql="select
p.cod_foto
from
productos as p
where
p.cod_sub=1
";
}
$res=mysql_query($sql,$con);
if ($reg=mysql_fetch_array($res))
{
$product=$reg["cod_foto"];
}else
{
header("Location: index.php");
}
//-------------------------------------------------------
/*$sql="select count
p.cod_foto , cod_foto1 , cod_foto2
from
productos as p
where
p.cod_sub=".$_GET["id"]."
";
$res=mysql_query($sql,$con);
if($reg=mysql_fetch_array($res))*/
?>
<!doctype html>
<html lang="es" class="no-js">
<head>
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/global.css">
<meta charset="utf-8">
<title>Documento sin título</title>
<link rel='stylesheet' type='text/css' href="css/styles.css" />
<link rel='stylesheet' type='text/css' href="css/styles2.css" />
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js'></script>
<script type='text/javascript' src="js/menu_jquery.js"></script>
<script type='text/javascript' src="js/menu2_jquery.js"></script>
</head>
<body>
<div id="gridContainer">
<div id="layoutDiv1"> <!--RESPONSIVE WEB DESIGN-->
<header>
<figure id="logo"> <!--slider-->
</figure>
<nav id="principal">
<a href="#">Inicio</a>
<a href="#">Inicio</a>
<a href="#">Inicio</a>
<a href="#">Inicio</a>
</nav>
</header>
<section>
<article class="productos">
<div id="primero">
<div id='cssmenu'> <!--Inicio del Menu -->
<ul>
<li class='active'><a href="#"><span>Productos</span></a></li>
<?php
$selec_linea = mysql_query("SELECT * FROM linea ORDER BY cod_lin ASC");
while ($lin = mysql_fetch_array($selec_linea))
{
$idlin=$lin['cod_lin'];
?>
<li class='has-sub'><a href="#"><span><?php echo $lin['des_lin'];?></span></a>
<?php
$selec_sublinea = mysql_query("SELECT * FROM sublinea WHERE cod_lin = '$idlin' ");
if(mysql_num_rows($selec_sublinea) == 0)
{
}
else
{
?>
<ul>
<?php
while ($lsub = mysql_fetch_array($selec_sublinea))
{
?>
<li><a href="productos.php?id=<?=$lsub["cod_sub"];?>"><span><?php echo $lsub["des_sub"];?></span></a></li>
<?php
}
?>
</ul>
<?php
}
?>
</li>
<?php
}
?>
</ul>
</div> <!--Fin del Div Menu -->
</div> <!--Fin del Div id Primero-->
<div id="segundo"> <!--Inicio del Div id segundo-->
<div id="interiorprincipal">
<?php
if (isset($_GET["pos"]))
{
$inicio=$_GET["pos"];
}else
{
$inicio=0;
}
$datos=$tra->get_paginacion_producto($inicio);
for ($i=0;$i<sizeof($datos);$i++)
{
?>
<div id="interior1">
<img src="imagenes/PRUEBA/<?php echo $datos[$i]["cod_foto"];?>" width="156">
</div>
<div id="interior2">
<img src="imagenes/PRUEBA/<?php echo $datos[$i]["cod_foto1"];?>" width="156">
</div>
<div id="interior3">
<img src="imagenes/PRUEBA/<?php echo $datos[$i]["cod_foto2"];?>" width="156">
</div>
<?php
}
?>
</div> <!--Fin del Div interiorPrincipalo-->
</div> <!--Fin del Div id segundo-->
<div id="tercero">
</div> <!--Fin del Div id tercero-->
</article>
</section>
<footer>
</footer>
</div>
</div>
<script src="js/modernizr.custom.81846.js"></script>
<script src="js/prefixfree.min.js"></script>
</body>
<!--<script src = "http://code.jquery.com/jquery-1.10.1.min.js"> </script>-->
<!--<script src = "http://code.jquery.com/jquery-migrate-1.2.1.min.js"> </script>-->
</html>
Valora esta pregunta


0