Foros del Web » Programando para Internet » PHP »

Establecer anchura de tabla html creada con php

Estas en el tema de Establecer anchura de tabla html creada con php en el foro de PHP en Foros del Web. Buenos días: He recurrido a un código que he encontrado en internet link: https://www.youtube.com/watch?v=FucYLYJ1D4M Lo he adaptado a mi base de datos Mysql y funciona. ...
  #1 (permalink)  
Antiguo 10/02/2015, 11:36
 
Fecha de Ingreso: noviembre-2005
Mensajes: 146
Antigüedad: 18 años, 5 meses
Puntos: 1
Establecer anchura de tabla html creada con php

Buenos días:
He recurrido a un código que he encontrado en internet
link: https://www.youtube.com/watch?v=FucYLYJ1D4M
Lo he adaptado a mi base de datos Mysql y funciona.
El problema es que no puedo dimensionar la anchura de la tabla.
El código es:
Código PHP:
Ver original
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4.     <meta   charset="utf-8">
  5.     <title>Solicitudes</title>
  6. </head>
  7. <body>
  8. <?php
  9. include("conexion.php");
  10.  
  11.  
  12. if(isset($_POST['update'])){
  13. $UpdateQuery = "UPDATE solicitudes
  14.                 SET Ref_Pres  ='$_POST[txtRef_Pres]',
  15.                     Ref_Serv  ='$_POST[txtRef_Serv]',
  16.                     Tiempo    ='$_POST[txtTiempo]',
  17.                     Usuarios  ='$_POST[txtUsuarios]',
  18.                     HoraI     ='$_POST[txtHoraI]',
  19.                     HoraII    ='$_POST[txtHoraII]',
  20.                     Reserva   ='$_POST[txtReserva]',
  21.                     Precio    ='$_POST[txtPrecio]',
  22.                     Coste     ='$_POST[txtCoste]',
  23.                     Sumprecio ='$_POST[txtSumprecio]',
  24.                     Sumcoste  ='$_POST[txtSumcoste]',
  25.                     Acron     ='$_POST[txtAcron]'
  26.                 WHERE Idpres_Serv ='$_POST[txtIdpres_Serv]'";              
  27. mysqli_query($cn,$UpdateQuery);
  28. };
  29.  
  30. if(isset($_POST['delete'])){
  31. $DeleteQuery = "DELETE FROM solicitudes WHERE Idpres_Serv='$_POST[txtIdpres_Serv]'";          
  32. mysqli_query($cn,$DeleteQuery);
  33. };
  34.  
  35. if(isset($_POST['add'])){
  36. $AddQuery = "INSERT INTO  solicitudes
  37.                          (
  38.                           Ref_Pres,
  39.                           Ref_Serv,
  40.                           Tiempo,
  41.                           Usuarios,
  42.                           HoraI,
  43.                           HoraII,
  44.                           Reserva,
  45.                           Precio,
  46.                           Coste,
  47.                           Sumprecio,
  48.                           Sumcoste,
  49.                           Acron
  50.                           )
  51.              VALUES
  52.                          (
  53.                         '$_POST[Ref_Pres]',
  54.                         '$_POST[Ref_Serv]',
  55.                         '$_POST[Tiempo]',
  56.                         '$_POST[Usuarios]',
  57.                         '$_POST[HoraI]',
  58.                         '$_POST[HoraII]',
  59.                         '$_POST[Reserva]',
  60.                         '$_POST[Precio]',
  61.                         '$_POST[Coste]',
  62.                         '$_POST[Sumprecio]',
  63.                         '$_POST[Sumcoste]',
  64.                         '$_POST[Acron]'
  65.                          )";        
  66. mysqli_query($cn,$AddQuery);
  67. };
  68.  
  69.  
  70.  
  71. $sql = "SELECT * FROM solicitudes WHERE IdServ = $id_tabla";
  72. $myData = mysqli_query($cn,$sql);
  73. echo "<table border=1>
  74. <tr>
  75.     <th>IdServ</th>
  76.     <th>Ref_Pres</th>
  77.     <th>Ref_Serv</th>
  78.     <th>Tiempo</th>
  79.     <th>Usuarios</th>
  80.     <th>HoraI</th>
  81.     <th>HoraII</th>
  82.     <th>Reserva</th>
  83.     <th>Precio</th>
  84.     <th>Coste</th>
  85.     <th>Sumprecio</th>
  86.     <th>Sumcoste</th>
  87.     <th>Acron</th>
  88. </tr>";
  89. while($record = mysqli_fetch_array($myData)){
  90. echo "<form action=form_solicitudes.php method=post>";
  91. echo "<tr>";
  92. echo "<td>" . "<input type=text class= 'min' name=txtIdpres_Serv    value=" . $record['Idpres_Serv'] . " </td>";
  93. echo "<td>" . "<input type=text class= 'min' name=txtRef_Pres       value=" . $record['Ref_Pres'] . " </td>";
  94. echo "<td>" . "<input type=text class= 'min' name=txtRef_Serv       value=" . $record['Ref_Serv'] . " </td>";
  95. echo "<td>" . "<input type=text class= 'min' name=txtTiempo         value=" . $record['Tiempo'] . " </td>";
  96. echo "<td>" . "<input type=text class= 'min' name=txtUsuarios       value=" . $record['Usuarios'] . " </td>";
  97. echo "<td>" . "<input type=text class= 'min' name=txtHoraI          value=" . $record['HoraI'] . " </td>";
  98. echo "<td>" . "<input type=text class= 'min' name=txtHoraII         value=" . $record['HoraII'] . " </td>";
  99. echo "<td>" . "<input type=text class= 'min' name=txtReserva        value=" . $record['Reserva'] . " </td>";
  100. echo "<td>" . "<input type=text class= 'min' name=txtPrecio         value=" . $record['Precio'] . " </td>";
  101. echo "<td>" . "<input type=text class= 'min' name=txtCoste          value=" . $record['Coste'] . " </td>";
  102. echo "<td>" . "<input type=text class= 'min' name=txtSumprecio      value=" . $record['Sumprecio'] . " </td>";
  103. echo "<td>" . "<input type=text class= 'min' name=txtSumcoste       value=" . $record['Sumcoste'] . " </td>";
  104. echo "<td>" . "<input type=text class= 'min' name=txtAcron          value=" . $record['Acron'] . " </td>";
  105.  
  106.  
  107.  
  108. echo "<td>" . "<input type=hidden name=hidden value=" . $record['Idpres_Serv'] . " </td>";
  109. echo "<td>" . "<input type=submit name=update value=update" . " </td>";
  110. echo "<td>" . "<input type=submit name=delete value=delete" . " </td>";
  111. echo "</tr>";
  112. echo "</form>";
  113. }
  114. echo "<form action=solicitudes.php method=post>";
  115. echo "<tr>";
  116. echo "<td><input type=text class= 'min' name=txtIdpres_Serv></td>";
  117. echo "<td><input type=text class= 'min' name=txtRef_Pres></td>";
  118. echo "<td><input type=text class= 'min' name=txtRef_Serv></td>";
  119. echo "<td><input type=text class= 'min' name=txtTiempo></td>";
  120. echo "<td><input type=text class= 'min' name=txtUsuarios></td>";
  121. echo "<td><input type=text class= 'min' name=txtHoraI></td>";
  122. echo "<td><input type=text class= 'min' name=txtHoraII></td>";
  123. echo "<td><input type=text class= 'min' name=txtReserva></td>";
  124. echo "<td><input type=text class= 'min' name=txtPrecio></td>";
  125. echo "<td><input type=text class= 'min' name=txtCoste></td>";
  126. echo "<td><input type=text class= 'min' name=txtSumprecio></td>";
  127. echo "<td><input type=text class= 'min' name=txtSumcoste></td>";
  128. echo "<td><input type=text class= 'min' name=txtAcron></td>";
  129.  
  130.  
  131. echo "<td>" . "<input type=submit name=add value=add" . " </td>";
  132. echo "</form>";
  133. echo "</table>";
  134.  
  135. ?>
  136.  
  137. </body>
  138. </html>

La linea 73 inicia la tabla.
He usado:
Código PHP:
Ver original
  1. echo <table border=1 width=50%>
  2. echo <table border=1 width=500>
  3. echo <table border=1 width=500px>
  4. echo <table border=1 width='500px'>
  5. echo <table border=1 width="500px">
y así sucesivamente.

Espero que alguien sepa como puedo hacerlo y la explicación de qué hago mal.
Gracias
  #2 (permalink)  
Antiguo 10/02/2015, 11:38
Avatar de pateketrueke
Modernizr
 
Fecha de Ingreso: abril-2008
Ubicación: Mexihco-Tenochtitlan
Mensajes: 26.399
Antigüedad: 16 años
Puntos: 2534
Respuesta: Establecer anchura de tabla html creada con php

Eso sería HTML/CSS únicamente ¿qué tiene que ver con código PHP?
__________________
Y U NO RTFM? щ(ºдºщ)

No atiendo por MP nada que no sea personal.
  #3 (permalink)  
Antiguo 10/02/2015, 12:30
 
Fecha de Ingreso: noviembre-2005
Mensajes: 146
Antigüedad: 18 años, 5 meses
Puntos: 1
Respuesta: Establecer anchura de tabla html creada con php

Cita:
Iniciado por pateketrueke Ver Mensaje
Eso sería HTML/CSS únicamente ¿qué tiene que ver con código PHP?
Hola:
Lo planteo como php ya que le código html que genero está "pintado" con php.
Puede que lo haya planteado en el foro inadecuado, pero el motivo ha sido ese.
Si en este foro no se puede atender, no sé si el administrador debe trasladarlo o bien yo mismo replantear la pregunta en el foro html/CSS.
En cualquier caso, gracias por tu atención.
Un saludo.

Etiquetas: establecer, html, mysql, select, sql, tabla, usuarios
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 23:10.