PHP - impresion de variables incorrecta

 
Vista:
sin imagen de perfil
Val: 557
Bronce
Ha mantenido su posición en PHP (en relación al último mes)
Gráfica de PHP

impresion de variables incorrecta

Publicado por zendi (1056 intervenciones) el 03/06/2014 00:06:45
Que tal a todos, heme por aqui otra vez.
Estoy desarrollando una pagina con un motor de busqueda, pero tengo un problemilla cuando se imprime, coloca la impresion de forma inadecuada, sino que se imprimen de forma vertical las variables, es decir que aparece estirada, cuando debiera hacerlo de forma horizontal. He revisado el estilo, los <table>, <tr> y los <td> pero no hallo el error, a ver si alguien puede verlo por favor.
Nota: el codigo que imprime en negrita
He aqui el codigo:
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
180
181
182
183
184
185
186
187
188
189
190
<?php
require_once("classblog.php");
$tra=new Trabajo();
 
$sql = "SELECT
       COUNT(*) AS total
	   FROM noticias
	  WHERE titulo
	   LIKE '%".$_GET['s']."%' or detalle
	   LIKE '%".$_GET['s']."%'";
$res = @pg_query(Conectar::con(),$sql);
if ($req = @pg_fetch_array($res))
{
	$total=$req["total"];
}
$resto = $total % 11;
$ultimo = $total-$resto;
//************************
if (isset($_GET["pos"]))
{
	$inicio=$_GET["pos"];
}
else
{
	$inicio=0;
}
$sql = "SELECT *
          FROM noticias
		 WHERE titulo
		 LIKE '%".$_GET['s']."%'  or detalle
		 LIKE '%".$_GET['s']."%'
		limit 10 offset $inicio";
$res = @pg_query(Conectar::con(),$sql);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Buscador</title>
<link href="css/estilos.css" type="text/css" rel="stylesheet"/>
<style type="text/css">
 
	#main{ width:800px; height:%100; float:left}
 
</style>
 
</head>
 
<body>
  <div id="header" align="center">Seguridad Industrial</div>
	<div id="main">
		<div id="menu">
			<?php include("menublog.php");?>
			<div id="buscador">
				<form name="buscador" method="get" action="resultados.php">
				<div id="buscador">
				  <input type="text" name="s" title="Buscar">
                  <a href="javascript:void(0)" title="Buscar"  onClick="document.buscador.submit();">
                  <img src="img/buscador.GIF" width="24" height="24" border="0">
			      </a>
				</div>
				</form>
			</div>
		</div>
	</div>
  </div>
<div id="main">
<table align="center" width="100" height="25">
<tr>
<td>
<h3 align="center">Resultados de la Busqueda</h3></td></tr>
   <tr>
    <td align="center">Titulo</td>
    <td align="center">Detalle</td>
   </tr>
<?php
if (@pg_num_rows($res)==0)
{
  ?>
  <tr>
      <td>
  No hay Registros para ese criterio de busqueda
      </td>
  </tr>
  <?php
}else
{
$impresos = 0;
while($req = pg_fetch_array($res))
{
$impresos ++;
?>
<tr align="center" width="100" valign="top" height="25">
   <td>
    <?php echo strtolower(str_replace("".$_GET["s"]."","<b>".$_GET["s"]."</b>",$req['titulo'])); ?></td>
   <td align="center" width="50" valign="top" height="25">
    <?php echo Conectar::corta_palabra($req["detalle"],150);?>...
<hr>
    <?php echo str_replace("".$_GET["s"]."","<b>".$_GET["s"]."</b>",$req['detalle']);?></td>
</tr>
<?php
}
}
?>
<tr>
<td>
<hr>
<?php
if (!$inicio == 0)
{
	?>
	<a href="resultados.php?s=<?php echo $_GET["s"]?>&pos=0" title="Primero">Primero</a>
	<?php
}
 
else
 
{
  ?>
	Primero
  <?php
}
?>
<?php
if ($inicio == 0)
{
  ?>
  Anterior
 
  <?php
}
else
{
 ?>
  <a href="resultados.php?s=<?php echo $_GET["s"]?>&pos=<?php echo $inicio-10;?>" title="Anterior">Anterior</a>
<?php
}
 
?>
 
<!---->
<?php
if($impresos==10)
{
?>
	<a href="resultados.php?s=<?php echo $_GET["s"]?>&pos=<?php echo $inicio+10;?>" title="Siguiente">Siguiente</a>
 <?php
}
else
{
?>
 Siguientes
<?php
}
?>
 
<?php
if ($inicio==$ultimo)
{
?>
 Ultimo
 
<?php
}
else
{
?>
<a href="resultados.php?s=<?php echo $_GET["s"]?>&pos=<?php echo $ultimo;?>" title="Ultimo">Ultimo</a>
 
<?php
}
?>
 
 
</td>
 
 
</tr>
 
</table>
 
 
 
</div>
 
 
 
</body>
</html>
envio tambien la impresion:



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
Imágen de perfil de Vainas
Val: 34
Ha aumentado su posición en 3 puestos en PHP (en relación al último mes)
Gráfica de PHP

impresion de variables incorrecta

Publicado por Vainas (262 intervenciones) el 03/06/2014 19:15:48
Has mirado el ancho y alto de la tabla?

<table align="center" width="100" height="25">

Es que con 100 de ancho...

Saludos.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar
sin imagen de perfil
Val: 557
Bronce
Ha mantenido su posición en PHP (en relación al último mes)
Gráfica de PHP

impresion de variables incorrecta

Publicado por zendi (1056 intervenciones) el 03/06/2014 20:52:40
lo coloque de este modo:
1
<tr align="center" width="10" height="10">
pero sigue igual el problema.
Ahora bien pero tambien tengo una duda con este div:
1
<div id="main">

el cual viene de estos estilos:
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
body{ margin-left:0px; margin-top:0px; font-family: arial;}
 
#principal{ width:800px; font-size:12px}
 
	#header{ width:800px; height:100px; background-color:#FFCC33; color:#FFFFFF; float:left}
	#main{ width:50px; height:%10; float:left}
		#menu{ width:800px; height:25px; float:left;}
			.boton{ width:120px; height:25px; float:left; background-color:#000000; color:#FFFFFF}
			.url_boton{ text-decoration:none; color:#FFFFFF}
			#buscador{ width:200px; height:25px; float:left; text-align:center}
 
 
 
		#content{ width:800px; float:left;}
			#contenedor{ width:600px; float:left;}
 
				#separador_post{ width:600px; height:20px; float:left}
				#post{ width:600px; float:left; text-align:center}
 
 
					#titulo_post{ width:600px; height:20px; float:left}
						#titulo{ width:400px; height:20px; float:left; text-align:left; font-weight:bold}
						#fecha{ width:200px; height:20px; float:right; text-align:right}
					#texto_post{ width:600px; float:left; text-align:left}
					#separador_texto_debajo{ width:600px; height:10px; float:left}
					#debajo_post{ width:600px; height:20px; float:left}
						#leer_mas{ width:400px; height:20px; float:left; text-align:left}
						#comentarios{ width:200px; height:20px; float:left; text-align:right}
					#div_entre_post{ width:600px; height:5px; float:left; background-color:#000000}
					#div_paginacion_post{ width:600px; height:25px; float:left; text-align:center}
 
  #formulario{ width:800px; height:20px; text-align:center; background-color:#0099CC}
 
			#sidebar{ width:200px; float:left}
				#separador_widget{ width:200px; height:20px; float:left}
				#widget{ width:200px; float:left; margin-left:15px}
					.separador_lateral_widget{ width:15px; float:left}
					#caja_widget{ width:170px; float:left}
						#titulo_widget{ width:170px; height:20px; float:left; text-align:center; background-color:#333333; color:#FFFFFF}
						#contenido_widget{ width:170px; height:20px; float:left; background-color:#F0F0F0; text-align:left}
			#footer{ width:800px; height:20px; float:left; text-align:center}
pero busqué si el div:
1
<div id="main">
tiene algun error y no veo cual será
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar
Imágen de perfil de Vainas
Val: 34
Ha aumentado su posición en 3 puestos en PHP (en relación al último mes)
Gráfica de PHP

impresion de variables incorrecta

Publicado por Vainas (262 intervenciones) el 04/06/2014 09:40:32
Buenas de nuevo:

Primero que nada veamos un poco lo que dicen en internet: http://www.w3schools.com/tags/att_td_width.asp

Hay un parrafo rojo que pone que ese atributo ya no esta soportado en HTML5 y que uses CSS para ello.

Esto es un ejemplo de como lo puedes hacer:

1
<table style="width:200px">

px significa que lo hara en pixeles. Puedes usar tambien %. Yo probaria en la tabla primero con 100% para ver que sucede.

Luego tienes que aplicar un ancho y un alto a las columnas no a las filas:

1
<td style="width:30%">January</td>

px o % al igual que en table. yo probaria con 50% para cada columna si son 2... 33% si son 3 y asi...

El div ese esta antes de la tabla. No creo que tenga que ver nada. Y sino prueba cambiar los px por %.

Ya nos contaras. Saludos.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar