Re: Clean Up the sand box time

From: Date: Fri, 22 Aug 2003 21:30:36 +0000
Subject: Re: Clean Up the sand box time
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-160452@lists.php.net to get a copy of this message
Absolutely, the best way *tongue in cheek* is to format as follows: $news = mysql_query($sql) or die( print "document.write(\"".mysql_error()."\");"); $found = 0; while( $mydata = mysql_fetch_object( $news ) ) { if( $getaddr == $mydata->IPAddress ) { $found = 1; } } if( $found > 0 ) { echo "document.write(\"$getaddr already visited. \");"; } else { echo "document.write(\"insert $getaddr into $table. \");"; } Look how neat that is, who could possibly come up with a better style of formatting than that!? Cheers, Rob. On Fri, 2003-08-22 at 17:26, John Taylor-Johnston wrote: > This is my favourite question. Can I clean up my 'if then' statements a tad? > Must be a cleaner way? > Still learning, still having fun :) > Thanks, > John > > $news = mysql_query($sql) or die(print > "document.write(\"".mysql_error()."\");"); > > $found = 0; > while ($mydata = mysql_fetch_object($news)) > { > if($getaddr == $mydata->IPAddress) > { > $found = 1; > } > } > > if ($found > 0) > { > echo "document.write(\"$getaddr already visited. \");"; > }else{ > echo "document.write(\"insert $getaddr into $table. \");"; > } -- .---------------------------------------------. | Worlds of Carnage - http://www.wocmud.org | :---------------------------------------------: | Come visit a world of myth and legend where | | fantastical creatures come to life and the | | stuff of nightmares grasp for your soul. | `---------------------------------------------'

« previous php.general (#160452) next »