Page 2 of 2

Posted: Sat Nov 26, 2005 1:13 pm
by JasonTC
trukfixer wrote:mysql_fetch_row() fetches a *SINGLE* row
you want either mysql_fetch_array($result) or mysql_fetch_assoc($result)

try either of those with the var_dump($row); stuff above and see what happens (or try all three fetch methods)
You mean like this?

Code: Select all

echo mysql_error();
	echo"<pre>";
	var_dump($result);
	
	// send a message to each e-mail address in the table
	while ($row = odbc_fetch_array($result)) // also tried fetch_assoc
	{
		$email = $row['email'];
		echo "mail to: <b>\$email</b>: $email<br>";
		send_message($email, $subject, $message);
	}
	
	var_dump($row);
Because both those gave the same results as fetch_row. I notice that you're suggesting mysql fetch functions while I'm using odbc functions. Probably doesn't make a difference, but it's probably good to be aware of every detail. I'm gonna do a little experiement and see if I can get ANY data from the database with this script, even if it's not necessarily the data I want, because I have some other scripts using the same exact connection script and getting results. So don't worry about thinking too hard about this - I'll post again if my situation gets really desperate.

Thanks,
Jason

Posted: Sat Nov 26, 2005 2:43 pm
by JasonTC
Well, I figured it out. Apparently it had something to do with the db connection. I never pinpointed the problem - I just started over from scratch out of frustration.