Tema: Html en php
Ver Mensaje Individual
  #9 (permalink)  
Antiguo 12/10/2008, 18:05
Avatar de after
after
 
Fecha de Ingreso: junio-2006
Ubicación: De marte
Mensajes: 791
Antigüedad: 17 años, 11 meses
Puntos: 10
Respuesta: Html en php

el codigo:
Código php:
Ver original
  1. <?php require_once('../Connections/basbase.php'); ?>
  2. <?php
  3. if (!function_exists("GetSQLValueString")) {
  4. function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
  5. {
  6.   $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  7.  
  8.   $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
  9.  
  10.   switch ($theType) {
  11.     case "text":
  12.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  13.       break;    
  14.     case "long":
  15.     case "int":
  16.       $theValue = ($theValue != "") ? intval($theValue) : "NULL";
  17.       break;
  18.     case "double":
  19.       $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
  20.       break;
  21.     case "date":
  22.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  23.       break;
  24.     case "defined":
  25.       $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
  26.       break;
  27.   }
  28.   return $theValue;
  29. }
  30. }
  31.  
  32. mysql_select_db($database_basbase, $basbase);
  33. $query_Recordset1 = "SELECT * FROM list_movies";
  34. $Recordset1 = mysql_query($query_Recordset1, $basbase) or die(mysql_error());
  35. $row_Recordset1 = mysql_fetch_assoc($Recordset1);
  36. $totalRows_Recordset1 = mysql_num_rows($Recordset1);
  37. ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  38. <html xmlns="http://www.w3.org/1999/xhtml">
  39. <head>
  40. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  41. <title>Documento sin t&iacute;tulo</title>
  42. </head>
  43.  
  44. <body>
  45. <table border="1">
  46.   <tr>
  47.     <td>ID</td>
  48.     <td>name_movie</td>
  49.     <td>lenguage</td>
  50.     <td>Sub</td>
  51.     <td>year</td>
  52.     <td>tipe</td>
  53.     <td>format</td>
  54.     <td>mn</td>
  55.     <td>info</td>
  56.     <td>img</td>
  57.   </tr>
  58.   <?php do { ?>
  59.     <tr>
  60.       <td><?php echo $row_Recordset1['ID']; ?></td>
  61.       <td><?php echo $row_Recordset1['name_movie']; ?></td>
  62.       <td><?php echo $row_Recordset1['lenguage']; ?></td>
  63.       <td><?php echo $row_Recordset1['Sub']; ?></td>
  64.       <td><?php echo $row_Recordset1['year']; ?></td>
  65.       <td><?php echo $row_Recordset1['tipe']; ?></td>
  66.       <td><?php echo $row_Recordset1['format']; ?></td>
  67.       <td><?php echo $row_Recordset1['mn']; ?></td>
  68.       <td><?php echo $row_Recordset1['info']; ?></td>
  69.       <td><?php echo $row_Recordset1['img']; ?></td>
  70.     </tr>
  71.     <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
  72. </table>
  73. </body>
  74. </html>
  75. <?php
  76. mysql_free_result($Recordset1);
  77. ?>

con funcion

Código php:
Ver original
  1. <?php require_once('../Connections/basbase.php'); ?>
  2. <?php
  3. function tab1(){
  4. if (!function_exists("GetSQLValueString")) {
  5. function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
  6. {
  7.   $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  8.  
  9.   $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
  10.  
  11.   switch ($theType) {
  12.     case "text":
  13.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  14.       break;    
  15.     case "long":
  16.     case "int":
  17.       $theValue = ($theValue != "") ? intval($theValue) : "NULL";
  18.       break;
  19.     case "double":
  20.       $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
  21.       break;
  22.     case "date":
  23.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  24.       break;
  25.     case "defined":
  26.       $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
  27.       break;
  28.   }
  29.   return $theValue;
  30. }
  31. }
  32.  
  33. mysql_select_db($database_basbase, $basbase);
  34. $query_Recordset1 = "SELECT * FROM list_movies";
  35. $Recordset1 = mysql_query($query_Recordset1, $basbase) or die(mysql_error());
  36. $row_Recordset1 = mysql_fetch_assoc($Recordset1);
  37. $totalRows_Recordset1 = mysql_num_rows($Recordset1);
  38. ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  39. <html xmlns="http://www.w3.org/1999/xhtml">
  40. <head>
  41. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  42. <title>Documento sin t&iacute;tulo</title>
  43. </head>
  44.  
  45. <body>
  46. <table border="1">
  47.   <tr>
  48.     <td>ID</td>
  49.     <td>name_movie</td>
  50.     <td>lenguage</td>
  51.     <td>Sub</td>
  52.     <td>year</td>
  53.     <td>tipe</td>
  54.     <td>format</td>
  55.     <td>mn</td>
  56.     <td>info</td>
  57.     <td>img</td>
  58.   </tr>
  59.   <?php do { ?>
  60.     <tr>
  61.       <td><?php echo $row_Recordset1['ID']; ?></td>
  62.       <td><?php echo $row_Recordset1['name_movie']; ?></td>
  63.       <td><?php echo $row_Recordset1['lenguage']; ?></td>
  64.       <td><?php echo $row_Recordset1['Sub']; ?></td>
  65.       <td><?php echo $row_Recordset1['year']; ?></td>
  66.       <td><?php echo $row_Recordset1['tipe']; ?></td>
  67.       <td><?php echo $row_Recordset1['format']; ?></td>
  68.       <td><?php echo $row_Recordset1['mn']; ?></td>
  69.       <td><?php echo $row_Recordset1['info']; ?></td>
  70.       <td><?php echo $row_Recordset1['img']; ?></td>
  71.     </tr>
  72.     <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
  73. </table>
  74. </body>
  75. </html>
  76. <?php
  77. mysql_free_result($Recordset1);
  78. ?><? } ?>
con global como ?:S
__________________
@ivancamiloGo