note 56709 deleted from control-structures.while by philip

From: Date: Thu, 27 Apr 2006 15:51:33 +0000
Subject: note 56709 deleted from control-structures.while by philip
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-109864@lists.php.net to get a copy of this message
Note Submitter: admin at z-hoster dot com ---- // EVEN / ODD LOOP Script (Paire Impaire) // Boucle Paire / Impaire $server = "localhost"; $database = "xxx"; $db_user = "xxx"; $db_pass = "xxx"; $table = "xxx"; mysql_connect($server, $db_user, $db_pass) or die (mysql_error()); $result = mysql_db_query($database, "SELECT * FROM $table") or die (mysql_error()); // Give $total a number // Ont donne à $total un nombre if ($total==''){$total='0';} // Start the loop // Ont commence la boucle while($p = @mysql_fetch_array($result)) { // Get EVEN / ODD // Ont donne la valeur paire et impaire if ($total=='0'){ $mod='paire';}else{ $mod='impaire'; $total=-1; } // If $mod = EVEN // Si $mod = PAIRE if($mod=='paire'){echo"align='left'";} // If $mod = ODD // Si $mod = IMPAIRE if($mod=='impaire'){echo"align='right'";} $total++; }

« previous php.notes (#109864) next »