<?php require_once('file:///E|/UNADM/Decimo%20cuatrimestre/Programaci%C3%B3n%20Web%20I/AbogadosSC/Connections/AbogadosSC.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

$maxRows_Consulta = 10;
$pageNum_Consulta = 0;
if (isset($_GET['pageNum_Consulta'])) {
  $pageNum_Consulta = $_GET['pageNum_Consulta'];
}
$startRow_Consulta = $pageNum_Consulta * $maxRows_Consulta;

mysql_select_db($database_AbogadosSC, $AbogadosSC);
$query_Consulta = "SELECT * FROM formulario";
$query_limit_Consulta = sprintf("%s LIMIT %d, %d", $query_Consulta, $startRow_Consulta, $maxRows_Consulta);
$Consulta = mysql_query($query_limit_Consulta, $AbogadosSC) or die(mysql_error());
$row_Consulta = mysql_fetch_assoc($Consulta);

if (isset($_GET['totalRows_Consulta'])) {
  $totalRows_Consulta = $_GET['totalRows_Consulta'];
} else {
  $all_Consulta = mysql_query($query_Consulta);
  $totalRows_Consulta = mysql_num_rows($all_Consulta);
}
$totalPages_Consulta = ceil($totalRows_Consulta/$maxRows_Consulta)-1;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Documento sin título</title>
</head>

<body>
<table border="1">
  <tr>
    <td>nombre</td>
    <td>empresa</td>
    <td>email</td>
    <td>mensaje</td>
  </tr>
  <?php do { ?>
    <tr>
      <td><?php echo $row_Consulta['nombre']; ?></td>
      <td><?php echo $row_Consulta['empresa']; ?></td>
      <td><?php echo $row_Consulta['email']; ?></td>
      <td><?php echo $row_Consulta['mensaje']; ?></td>
    </tr>
    <?php } while ($row_Consulta = mysql_fetch_assoc($Consulta)); ?>
</table>
</body>
</html>
<?php
mysql_free_result($Consulta);
?>
