Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

leco_123

[Resolvido] data atual hoje

Recommended Posts

quando chegar na data final a foto não pode mais aparecer mais não to conseguindo puxar data atual do sitema

 

 

se data final "que é de agora" for igual ou maior que datasaida não pode imprimir nada se não vai imprimir a foto

 

 

 

 $datasaida=date("dd/mm/YYYY");              		     
		if ($row_prc['data_final_cobranca']==<'$datasaida'){
               echo '';}else{
               echo $row_prc['foto_parceiro'];} ?>

Compartilhar este post


Link para o post
Compartilhar em outros sites
<?
$datasaida= date("Y-m-d"); // verifica como ta gravado no seu db em qual formato o padrao no db é Y-m-d

//pode pegar de varias maneira mas tem q pegar exatamente como foi gravado pra comparar


echo date("Y/m/d") . "<br />";
echo date("Y.m.d") . "<br />";
echo date("Y-m-d")

//vai retornar

2009/05/11
2009.05.11
2009-05-11 

Compartilhar este post


Link para o post
Compartilhar em outros sites

Fiz mais ainda não deu certo é ("Y-m-d") mais ainda continua dando erro

Compartilhar este post


Link para o post
Compartilhar em outros sites

mas qual o erro que exibe??

 

oq ta retorno cada variavel.

 

Posta o erro e o select que você ta fazendo que fica mais facil ajudar.

 

 

==< coloca <=

Compartilhar este post


Link para o post
Compartilhar em outros sites

é o seguinte peguei este código na internet e funcionou corretamente mais eu quis dar uma mudada

fazer a seguinte questão quando a data do sistema for maior que a data do banco de dados então excluir foto

 

o erro da página é este: Parse error: syntax error, unexpected '<' in C:\xampp\htdocs\tccp\parceiros.php on line 110

	<?php require_once('Connections/milcoisas.php'); ?><?php require_once('Connections/milcoisas.php'); ?><?phpif (!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;}}mysql_select_db($database_milcoisas, $milcoisas);$query_prc = "SELECT * FROM parceiros ORDER BY valor_propaganda DESC";$prc = mysql_query($query_prc, $milcoisas) or die(mysql_error());$row_prc = mysql_fetch_assoc($prc);$totalRows_prc = mysql_num_rows($prc);?> <!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=iso-8859-1",true /><title>1000 Coisas </title><link href="style.css" rel="stylesheet" type="text/css" /></head><body><div id="totalpg"> 		     <!--Inicio fundo topo--> 	     	       <div id="funfotopo">                                                 	<!--Inicio fundo topo2-->                      <div id="funfotopo2">                                                			                                                                                	</div>                        <!--Fundo fundo topo2-->          </div>  <!--Fundo fundo topo-->                       			                        	<!--inicio baixotopo-->  <div id="baixotopo"></div>  		     <!--inicio baixotopo-->                       	<div id="conteudo">  	<!--aqui começa menu-->    <div id="menu">      <table width="735" border="0">        <tr>          <td width="115"><div align="center"><a href="index.php" target="_parent">Home</a></div></td>          <td width="169"><div align="center"><a href="mapa.php" target="_parent">Mapa</a></div></td>          <td width="142"><div align="center"><a href="dicas.php" target="_parent">Dicas</a></div></td>          <td width="142"><div align="center"><a href="contato.php" target="_parent">Contato</a></div></td>          <td width="145"><div align="center"><a href="sobre.php">Sobre</a></div></td>        </tr>      </table>    </div><!--aqui termina menu-->               		          <!-- inicio menu dois--> 		          <div id="menudois"><a href="index.php" target="_parent" title="Página Inicial">Home</a><a href="mapa.php" target="_parent" title="Mapa Localização Empresa">Mapa</a><a href="dicas.php" target="_parent" title="Dicas ">Dicas</a><a href="contato.php" target="_parent" title="Contato">Contato</a><a href="sobre.php" target="_parent" title="Sobre a Empresa">Sobre</a><a href="produtos_pg.php" target="_parent" title="Nossos Produtos">Produtos</a><a href="clientes_pg.php" target="_parent" title="Clientes">Clientes</a><a href="parceiros.php" target="_parent" title="Parceiros">Parceiros</a></div> 		          <!-- fim menu dois-->    <div id="parceiroscont">      <table align="left">        <tr>          <?phpdo { // horizontal looper version 3?>            <td><div id="parceirosfoto">              <div align="center"><a href="<?php echo $row_prc['site_parceiro']; ?>" target="_blank"><img src="foto_parceiros/<?php		  			     					     			          	$datasaida= date("Y-m-d");              		  	if ($row_prc['data_final_cobranca']==<'$datasaida'){		  	echo '';		  	}else{	      	echo $row_prc['foto_parceiro']; ?>" width="129" height="71" /></a></div>                                                </div></td>            <?php$row_prc = mysql_fetch_assoc($prc);    if (!isset($nested_prc)) {      $nested_prc= 1;    }    if (isset($row_prc) && is_array($row_prc) && $nested_prc++ % 4==0) {      echo "</tr>";    }  } while ($row_prc); //end horizontal looper version 3?>        </tr>      </table>    </div>    <!--Inicio conteudold lado direito-->    <!--Final conteudold lado direito-->	</div><!--Aqui termina Conteudo Pagina-->                <!--Aqui Começa rodapé Pagina-->       	<div id="rodape">            <div id="principal">              <div id="rodape2">                <div align="center">Copryght@2011 Todos os Direitos Reservados para 1000   Coisas <a href="login.php" target="_parent">admin</a></div>              </div>              <!--  Inicio   rodapé copryght -->            </div>            <!--  Final div principal bacground do site  -->          </div>          <!--Aqui termina rodapé Pagina--> 	</div> <!--Final div totalpg--></body></html><?phpmysql_free_result($prc);?>

 

 

 

Compartilhar este post


Link para o post
Compartilhar em outros sites

Porque você não faz isso direto na sua query?

$query_prc = "SELECT * FROM parceiros WHERE data_final_cobranca < NOW() ORDER BY valor_propaganda DESC";

 

Se o número de linhas retornadas foi maior que zero, ele mostra, caso o contrário não.

http://imasters.com.br/artigo/2340?cn=2340&cc=133

http://imasters.com.br/artigo/2362?cn=2362&cc=133

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.