MySQL - therme php - no carga el contenido de la base de datos

 
Vista:

therme php - no carga el contenido de la base de datos

Publicado por miguel angel (1 intervención) el 01/08/2014 17:11:39
Buenas tardes.

Voy de cabeza con una llamada a myadmin sql , la pagina no carga el contenido de la base de datos.

os dejo el código creado por si hay algo que no he echo correctamente.

gracias de antemano.

un saludo

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
<?
<?
 
	$db = include ('conexion_bbdd.inc');
 
	$idcat = $HTTP_GET_VARS ["?"];
 
	if (!isset($HTTP_GET_VARS["img"])) { $idimg = -1; }
	else { $idimg = $HTTP_GET_VARS["img"]; }
 
	$result = mysql_query("SELECT titulo, texto, cat_id, fondo FROM categoria where id=".$idcat,$db);
      $myrow = mysql_fetch_row($result);
	$titulo = $myrow[0];
	$texto = $myrow[1];
      $fondo = $myrow[3];
 
 
if ($idcat == 40 or $idcat == 41 or $idcat == 42 or $idcat == 43 or $idcat == 44){
		$fondo1 = "#779D83"; $fondo2 = "#D6AD75"; $fondo3 = "#EBEBD9"; $fondo4 = "#F3F3B3";
		$imafondo = "Imagenes/logo2.gif";
		$imaini = "Imagenes/ini2.gif";
		$imasig = "Imagenes/sig2.gif";
	}
	else if ($idcat == 30){
		$fondo1 = "#25C7EE"; $fondo2 = "#7BE4FF"; $fondo3 = "#E9EDFF"; $fondo4 = "#D5D4CF";
		$imafondo = "Imagenes/logo3.gif";
		$imaini = "Imagenes/ini3.gif";
		$imasig = "Imagenes/sig3.gif";
	}
	else if ($idcat == 20){
		$fondo1 = "#6B7860"; $fondo2 = "#B09473"; $fondo3 = "#E9E6DE"; $fondo4 = "#EEE5D4";
		$imafondo = "Imagenes/logo1.gif";
		$imaini = "Imagenes/ini1.gif";
		$imasig = "Imagenes/sig1.gif";
	}
	else if ($idcat == 60){
		$fondo1 = "#66AA99"; $fondo2 = "#AABBAA"; $fondo3 = "#D8E6A9"; $fondo4 = "#FDF1B1";
		$imafondo = "Imagenes/logo4.gif";
		$imaini = "Imagenes/ini4.gif";
		$imasig = "Imagenes/sig4.gif";
	}
	else if ($idcat == 0 or $idcat == 1 or $idcat == 2 or $idcat == 3 or $idcat == 4 or $idcat == 6 or $idcat == 7 or $idcat == 8 or $idcat == 9 or $idcat == 10 or $idcat == 11 or $idcat == 64 or $idcat == 65 or $idcat == 66)
	{
		$fondo1 = "#85694C"; $fondo2 = "#C99348"; $fondo3 = "#F1EAAF"; $fondo4 = "#DFD6C8";
		$imafondo = "Imagenes/logo7.gif";
		$imaini = "Imagenes/ini7.gif";
		$imasig = "Imagenes/sig7.gif";
	}
	else{
		$fondo1 = "#6B7860"; $fondo2 = "#B09473"; $fondo3 = "#F3EFE4"; $fondo4 = "#EEE5D4";
		$imafondo = "Imagenes/logo1.gif";
		$imaini = "Imagenes/ini1.gif";
		$imasig = "Imagenes/sig1.gif";
	}
 
 
?>
 
<html>
 
<head>
	<LINK HREF="estilo.css" TYPE="text/css" REL="Stylesheet">
</head>
 
<body>
 
<div align="center">
 
	<table cellspacing=0 cellpadding=5 class="tablacategoria" width=950>
 
		<? include("cabecera.inc"); ?>
		<tr>
 
			<?
				echo '<td colspan="2" valign="top" align="center" width="100%" bgcolor='.$fondo3.'  style="background-image: url(Imagenes/fondos/'.$fondo.'); background-repeat: repeat; background-position: left top; ">';
				echo '<br>';
				echo '<table cellpadding=20><tr><td>';
				if ($idimg == -1)
				{
					echo '<div align="center"> <h1>'.$titulo.'</h1> </div>';
					echo $texto;
					echo '<br>';
				}
				else
				{
 
 
					$resultimg = mysql_query("SELECT * from foto where cat_id =".$idcat,$db);
					$encontrado = false;
					$anterior = null;
					$siguiente = null;
					while($encontrado==false and $myimg = mysql_fetch_row($resultimg))
					{
						$id = $myimg[0];
						if ($id == $idimg) $encontrado = true;
						else $anterior = $myimg[0];
					}
					$myimg = mysql_fetch_row($resultimg);
					$siguiente = $myimg[0];
					echo '<div align="right">';
					echo '<i><b>';
					if ($anterior != null) echo '<a href=vercategoria.php?id='.$idcat.'&img='.$anterior.'> Anterior </a>';
					if ($anterior != null and $siguiente != null) echo '&nbsp;||&nbsp;';
					if ($siguiente != null) echo '<a href=vercategoria.php?id='.$idcat.'&img='.$siguiente.'> Siguiente </a>';
					echo '&nbsp;&nbsp;</i></b>';
					echo '</div>';
 
					echo '<div align="center"> <h1>'.$titulo.'</h1> </div>';
 
					$resultimg = mysql_query("SELECT mime, nombre from foto where id =".$idimg,$db);
					$myimg = mysql_fetch_row($resultimg);
					$mime = $myimg[0];
					$nombre = $myimg[1];
					$ruta = "fotos/".$idimg.".".$mime;
					echo '<div align="center">';
					echo '<img border=1 src="'.$ruta.'">';
					echo '<br><br>';
					echo '<i>'.$nombre.'</i>';
					echo '<br><br>';
					echo '</div>';
					echo '<div align="left">';
					echo '<a href="vercategoria.php?id='.$idcat.'">';
					echo '<b><< Ver texto</b>';
					echo '</a>';
					echo '</div>';
				}
				echo '</td></tr></table>';
			?>
			</td>
		</tr>
		<? include ("pie.inc"); ?>
		</table>
 
</div>
 
</body>
 
</html>
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