Foros del Web » Programando para Internet » PHP »

mktime (date) PHP+SQL

Estas en el tema de mktime (date) PHP+SQL en el foro de PHP en Foros del Web. Hola gente!, miren tengo una duda haber si esta bien puesto este codigo, lo que quiero yo es que en mi pagina, aya un top ...
  #1 (permalink)  
Antiguo 13/10/2010, 09:33
 
Fecha de Ingreso: octubre-2009
Mensajes: 84
Antigüedad: 14 años, 6 meses
Puntos: 0
mktime (date) PHP+SQL

Hola gente!, miren tengo una duda haber si esta bien puesto este codigo, lo que quiero yo es que en mi pagina, aya un top de los articlos agradecidos asi que hice esto:

Código:
$spasibo_news = dle_cache( "spasibo-news", $config['skin'] );

if(! $spasibo_news ) {

if( $threenews['on'] == "1" )

$this_week = date( 'Y-m-d', time()-( 3600*24*7 ) );

	$res = $db->query( "SELECT id, title, date, alt_name FROM " . PREFIX . "_post WHERE approve='1' AND date >= '$this_week'AND date < '$this_week' + INTERVAL 1 WEEK ORDER BY spasibo_num DESC LIMIT 0, {$threenews['limit']}" );

	while( $row = $db->get_row( $res ) ) {

	$row['date'] = strtotime( $row['date'] );

	if( strlen( $row['title'] ) > $threenews['titlelimit'] )
		$title = substr( $row['title'], 0, $threenews['titlelimit'] ) . "...";
	else
		$title = $row['title'];

$go_page = ($config['ajax']) ? "onclick=\"DlePage('newsid=" . $row['id'] . "'); return false;\" " : "";

	if ($config['allow_alt_url'] == "yes")
		$link = "<a {$go_page} href=\"" . $config['http_home_url'] . $row['id'] . "-" . $row['alt_name'] . ".html\">" . stripslashes( $title ) . "</a>";
	else
		$link = "<a {$go_page} href=\"$PHP_SELF?newsid=" . $row['id'] . "\">" . stripslashes( $title ) . "</a>";

	$spasibo_news .= "<div onmouseover=\"this.className='lastcomm_over1';\" onmouseout=\"this.className='lastcomm';\" class=\"lastcomm\"> {$threenews['sstrat']} " . $link . "</div>";
	}
	
	$db->free();
	create_cache( "spasibo-news", $spasibo_news, $config['skin'] );
	
}

Lo que esta en rojo es el código nuevo ya que si no pongo me toma todos los artículos agradecidos y no se actualizaría cada 1 semana

Bueno nose si esta bien puesto, haber si alguien me puede ayudar!!

SALUDOS!
  #2 (permalink)  
Antiguo 13/10/2010, 14:16
Avatar de GatorV
$this->role('moderador');
 
Fecha de Ingreso: mayo-2006
Ubicación: /home/ams/
Mensajes: 38.567
Antigüedad: 17 años, 10 meses
Puntos: 2135
Tema movido desde Configuración PHP a PHP

Etiquetas: date, mktime
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 17:18.