note 91184 deleted from function.mysql-query by danbrown

From: Date: Fri, 29 May 2009 02:23:52 +0000
Subject: note 91184 deleted from function.mysql-query by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-156135@lists.php.net to get a copy of this message
Note Submitter: perezoso100 at hotmail dot com ---- This is another example of an easy query showing the picture in different sides in each loop. <? $sql="select titulo,contenido,foto,detalles from portada where portada=1"; $resultado=mysql_query($sql); $cantidad=mysql_num_rows($resultado); echo "There are $cantidad answers"; if($resultado==true){ $resultado=mysql_query($sql); while($fila=mysql_fetch_array($resultado)){ $vueltas++; if($vueltas %2==0){ $situacion="img_flota_dcha"; }else{ $situacion="img_flota_izq"; } echo $fila['titulo']; echo $fila['contenido']; str_replace (“\n”,”<br/>”,$fila['detalles']); /*replaces \n of the database with <br> for html*/ echo substr ($fila['detalles'],0,50) } ?> <img src="<?= $fila['foto']; ?" class="<?=$situacion ?>"> <? }//end while }//end if ?>

« previous php.notes (#156135) next »