Ver Mensaje Individual
  #4 (permalink)  
Antiguo 05/05/2008, 15:21
Avatar de Capimaster
Capimaster
 
Fecha de Ingreso: agosto-2004
Mensajes: 494
Antigüedad: 19 años, 9 meses
Puntos: 2
Re: Vinculo apuntado hacia entrada especifica de la base de datos

y este otro es el codigo del archivo que muestra cada nota por separado:

Código PHP:
<?php include('Connections/noticias.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function 
GetSQLValueString($theValue$theType$theDefinedValue ""$theNotDefinedValue ""
{
  
$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;
}
}

$currentPage $_SERVER["PHP_SELF"];

$maxRows_ultimas 1;
$pageNum_ultimas 0;
if (isset(
$_GET['pageNum_ultimas'])) {
  
$pageNum_ultimas $_GET['pageNum_ultimas'];
}
$startRow_ultimas $pageNum_ultimas $maxRows_ultimas;

mysql_select_db($database_noticias$noticias);
$query_ultimas "SELECT * FROM noticias";
$query_limit_ultimas sprintf("%s LIMIT %d, %d"$query_ultimas$startRow_ultimas$maxRows_ultimas);
$ultimas mysql_query($query_limit_ultimas$noticias) or die(mysql_error());
$row_ultimas mysql_fetch_assoc($ultimas);

if (isset(
$_GET['totalRows_ultimas'])) {
  
$totalRows_ultimas $_GET['totalRows_ultimas'];
} else {
  
$all_ultimas mysql_query($query_ultimas);
  
$totalRows_ultimas mysql_num_rows($all_ultimas);
}
$totalPages_ultimas ceil($totalRows_ultimas/$maxRows_ultimas)-1;

$queryString_ultimas "";
if (!empty(
$_SERVER['QUERY_STRING'])) {
  
$params explode("&"$_SERVER['QUERY_STRING']);
  
$newParams = array();
  foreach (
$params as $param) {
    if (
stristr($param"pageNum_ultimas") == false && 
        
stristr($param"totalRows_ultimas") == false) {
      
array_push($newParams$param);
    }
  }
  if (
count($newParams) != 0) {
    
$queryString_ultimas "&" htmlentities(implode("&"$newParams));
  }
}
$queryString_ultimas sprintf("&totalRows_ultimas=%d%s"$totalRows_ultimas$queryString_ultimas);
?><!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&iacute;tulo</title>
<style type="text/css">
<!--
body,td,th {
    font-family: Segoe UI, Arial, Times New Roman;
    font-size: 11px;
}
body {
    margin-left: 0px;
    margin-top: 0px;
    margin-right: 0px;
    margin-bottom: 0px;
}
-->
</style></head>

<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td bgcolor="#A50000"><img src="/images/logo.gif" width="380" height="70" /></td>
  </tr>
  <tr>
    <td><iframe src="http://www.elcapitolio.net/uonline52.php" width="100%" height="15" scrolling="No" frameborder="0"></iframe></td>
  </tr>
  <tr>
    <td><table width="96%" height="88" border="0" align="center" cellpadding="0" cellspacing="0">
      <?php do { ?>

      <tr>
        <td height="23"><div align="center">
            <h3><?php echo $row_ultimas['titulo']; ?></h3>
        </div></td>
      </tr>
      <tr>
        <td height="23"><?php echo $row_ultimas['contenido']; ?></td>
      </tr>
      <tr>
        <td height="42"><table border="0" align="center">
            <tr>
              <td><?php if ($pageNum_ultimas 0) { // Show if not first page ?>
                  <a href="<?php printf("%s?pageNum_ultimas=%d%s"$currentPagemax(0$pageNum_ultimas 1), $queryString_ultimas); ?>"><img src="/images/button_previous.jpg" border="0" /></a>
                  <?php // Show if not first page ?>              </td>
              <td><?php if ($pageNum_ultimas $totalPages_ultimas) { // Show if not last page ?>
                  <a href="<?php printf("%s?pageNum_ultimas=%d%s"$currentPagemin($totalPages_ultimas$pageNum_ultimas 1), $queryString_ultimas); ?>"><img src="/images/button_next.jpg" border="0" /></a>
                  <?php // Show if not last page ?>              </td>
            </tr>
          </table>
            <br />
            <table width="50%" border="0" align="center" cellpadding="0" cellspacing="0">
              <tr>
                <td><form id="form1" name="form1" method="post" action="">
                    <div align="center">
                      <input type="submit" name="Imprimir" id="Imprimir" value="Imprimir" onclick="window.print();return false" />
                      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                      <input type="submit" name="Imprimir" id="Imprimir" value="Cerrar" onclick="window.close()" />
                    </div>
                </form></td>
              </tr>
          </table></td>
      </tr>
      <?php } while ($row_ultimas mysql_fetch_assoc($ultimas)); ?>
    </table></td>
  </tr>
</table>
</body>
</html>
<?php
mysql_free_result
($ultimas);
?>
<script language=javascript>
function printNews(id){
    window.open("<? echo $path["webroot"?>newsannounce/home.print.php?news_id="+id,"Popup","width=550,height=450,top=70,left=100,dependent=yes,titlebar=no,scrollbars=yes,resizable=yes");    
}

function tellFriend(id,url){
    window.open("<? echo $path["webroot"?>newsannounce/home.tell.php?news_id="+id,"Popup","width=400,height=300,top=170,left=250,dependent=yes,titlebar=no,scrollbars=yes");    
}
</script>
Lamento la combinacion de HTML con PHP pero es que uso el mugroso DW
__________________
http://www.elcapitolio.com.mx - Ocotlán, Jalisco, México