Ver Mensaje Individual
  #1 (permalink)  
Antiguo 04/09/2008, 08:20
Avatar de Capimaster
Capimaster
 
Fecha de Ingreso: agosto-2004
Mensajes: 494
Antigüedad: 19 años, 8 meses
Puntos: 2
repetir region me es complicado por 1 situacion.

Ok tengo el siguiente codigo y todo funciona bien pero el problema es que if (banner==1) { ......} no puedo hacerlo una region de repeticion por que el numero ==1 despues cambia a ==2 y luego a ==3 ya que es un banner aleatorio y lo tengo que numerar asi,
no se si tengan po ahi alguna sugerencia?? quiero mostrar con ORDER BY id DESC

pero como le puedo hacer?

Código PHP:
<?php require_once('http://www.elcapitolio.net/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;
}
}

$maxRows_inserciones 3;
$pageNum_inserciones 0;
if (isset(
$_GET['pageNum_inserciones'])) {
  
$pageNum_inserciones $_GET['pageNum_inserciones'];
}
$startRow_inserciones $pageNum_inserciones $maxRows_inserciones;

mysql_select_db($database_noticias$noticias);
$query_inserciones "SELECT * FROM inser_gob ORDER BY id DESC";
$query_limit_inserciones sprintf("%s LIMIT %d, %d"$query_inserciones$startRow_inserciones$maxRows_inserciones);
$inserciones mysql_query($query_limit_inserciones$noticias) or die(mysql_error());
$row_inserciones mysql_fetch_assoc($inserciones);

if (isset(
$_GET['totalRows_inserciones'])) {
  
$totalRows_inserciones $_GET['totalRows_inserciones'];
} else {
  
$all_inserciones mysql_query($query_inserciones);
  
$totalRows_inserciones mysql_num_rows($all_inserciones);
}
$totalPages_inserciones ceil($totalRows_inserciones/$maxRows_inserciones)-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&iacute;tulo</title>
</head>

<body>
<script language="JavaScript"> 
<!-- 

var cuantosbanners = 3 ; 
var ahora = new Date() 
var segundos = ahora.getSeconds() 
var banner = segundos % cuantosbanners; 
banner +=1; 

if (banner==1) { 
texto=" <?php echo $row_inserciones['titulo']; ?> "; 
url=" <?php echo $row_inserciones['imagen']; ?> "; 
alt=" H. Ayuntamiento "; 
imagen=" <?php echo $row_inserciones['ruta']; ?> "; 
width=" <?php echo $row_inserciones['ancho']; ?> "; 
height=" <?php echo $row_inserciones['alto']; ?> "; 

if (banner==2) { 
texto=" <?php echo $row_inserciones['titulo']; ?> "; 
url=" <?php echo $row_inserciones['imagen']; ?> "; 
alt=" H. Ayuntamiento "; 
imagen=" <?php echo $row_inserciones['ruta']; ?> "; 
width=" <?php echo $row_inserciones['ancho']; ?> "; 
height=" <?php echo $row_inserciones['alto']; ?> "; 

if (banner==3) { 
texto=" <?php echo $row_inserciones['titulo']; ?> "; 
url=" <?php echo $row_inserciones['imagen']; ?> "; 
alt=" H. Ayuntamiento "; 
imagen=" <?php echo $row_inserciones['ruta']; ?> "; 
width=" <?php echo $row_inserciones['ancho']; ?> "; 
height=" <?php echo $row_inserciones['alto']; ?> "; 


document.write('<center>'); 
document.write('<a href="' + url + '" target="_blank">'); 
document.write('<img src="' + imagen + '" width=') 
document.write( width + ' height=' + height + ' '); 
document.write('alt="' + alt + '" border=0><br>'); 
document.write('<small>' + texto + '</small></a>'); 
document.write('</center>'); 

//--> 
              </script>
</body>
</html>
<?php
mysql_free_result
($inserciones);
?>
__________________
http://www.elcapitolio.com.mx - Ocotlán, Jalisco, México