Re: Endless 'while' loops?

From: Date: Mon, 03 Nov 2003 03:55:20 +0000
Subject: Re: Endless 'while' loops?
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-168372@lists.php.net to get a copy of this message
On Mon, 3 Nov 2003 12:29:10 +0900, you wrote: Without running the code, I can see two immediate problems. >$subject = "EigoImprov Newsletter for " .member[1]; should be $subject = "EigoImprov Newsletter for " . $member[1]; Also rewrite >$mailcontent = "Dear " .$member[0] .",\n".$message ."\nThis message was >sent to [2]" .$member; as something closer to $mailcontent = "Dear {$member[0]},\n$message\nThis message was sent to {$member[2]}"; There are a couple of other good-practice changes you could make: List the columns explicitly - that way your code will still work if the database structure gets changed: >$query = "select * from tablename where active = 1"; $query = "SELECT col1, col2, col3 FROM tablename WHERE active = 1"; >$result = mysql_query($query); Check for failure after doing the query. $result = mysql_query ($query); if ($result == FALSE) { die ("Query error"); }

« previous php.general (#168372) next »