What's the difference?

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
JasonTC
Forum Commoner
Posts: 92
Joined: Wed Nov 02, 2005 11:05 am
Location: Grand Rapids, MI

What's the difference?

Post by JasonTC »

This was originally posted in the code forum, but then I realized it's obviously a database question (please don't yell at me for double posting).

I have the following code (this is just part of one file):

Code: Select all

if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
	$subject		= $_POST['subject'];
	$message		= $_POST['message'];
	
	global $db_connection;
	$sql = "SELECT email FROM EmailAddresses;";
	$result = odbc_exec($db_connection, $sql);
	
	// send a message to each e-mail address in the table
	while ($row = odbc_fetch_array($result))
	{
		$email = $row['email'];
		echo "mail to: <b>\$email</b>: $email<br>";
		send_message($email, $subject, $message);
	}
	
	echo "<div class=\"normalFont\">Messages sent.</div>";
}
// if the user wasn't referred by a script, they shouldn't be here
else header("Location: login.php");
When I run it on my local server, I get:

Code: Select all

mail to: $email: drew_is_my_friend@hotmail.com
mail to: $email: fake_address@hotmail.com
mail to: $email: notreal@test.com
Messages sent.
And the messages are, in face, sent. When I run it on our Web server, I get nothing.

The database is definitely exactly the same on the web server as it is on the local server.

Here's what can be deduced in regard to what's going on with the Web server:
Since no output is being produced, the echo inside the while loop is probably not being executed.
One might think that, since the last echo command inside the if statement ("Messages sent.") is not producing output, the request method may be something other than "post". If this were the case, however, the browser would be redirected to login.php, which it is not.

Any ideas? I'm pretty much stumped.

Thanks,
Jason
ody
Forum Contributor
Posts: 147
Joined: Sat Mar 27, 2004 4:42 am
Location: ManchesterUK

Post by ody »

Dosnt seem very secure...
Post Reply