Jump to content

error help


R1der

Recommended Posts

I have spent countless hours tryign to work out the problem here but failed.

 

Please can someone fix this code for me?

 

I get this error

 

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/*****/public_html/emailall.php on line 14

Mail Sent To . .

 

 

<?php


include("config.php");



     $getEMails = Mysql_query("Select * from email");
     $loadMails = mysql_fetch_array($GetEMails);

{
  $message = "message here.";
  $subject = "subject here";
  $sendto = "$loadmails";
  mail($sendto, $subject, $message, $header);
  echo "Mail Sent To  . $loadMails[email]  . 
";
}

?>

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/71673-error-help/
Share on other sites

You always need to check whether the query ran successfully.  

 

$getEMails = mysql_query("Select * from email");
if(!$getEMails)
{
 die("Error " . mysql_errno() . ": " . mysql_error());
}
$loadMails = mysql_fetch_array($GetEMails);

 

This will tell you why the query failed.

 

Oh, I just saw the bug.  You are calling Mysql_query().  The real function is mysql_query() (notice the capitalization).

Link to comment
https://forums.phpfreaks.com/topic/71673-error-help/#findComment-360812
Share on other sites

Thanks for the replys..

 

I will start by saying i changed the uppercase "M" to a lowercase but still get the error.

 

ok i also added the code you posted but still get the same error w/out error report

 

 

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/r1der1/public_html/emailall.php on line 13

Mail Sent To . .

Link to comment
https://forums.phpfreaks.com/topic/71673-error-help/#findComment-360834
Share on other sites

<?php


include("config.php");



$getEMails = mysql_query("Select * from userdb");
if(!$getEMails)
{
die("Error " . mysql_errno() . ": " . mysql_error());
}
$loadMails = mysql_fetch_array($GetEMails);

{
$message = "ftest.";
$subject = "test";
$sendto = "$loadmails";
mail($sendto, $subject, $message, $header);
echo "Mail Sent To . $loadMails[email] . 
";
}

?>

Link to comment
https://forums.phpfreaks.com/topic/71673-error-help/#findComment-360848
Share on other sites

Just for kicks.  I added a print_r().  Maybe that will give us more information.

 

<?php


include("config.php");



$getEMails = mysql_query("Select * from userdb");
print_r($getEMails);
if(!$getEMails)
{
die("Error " . mysql_errno() . ": " . mysql_error());
}
$loadMails = mysql_fetch_array($GetEMails);

{
$message = "ftest.";
$subject = "test";
$sendto = "$loadmails";
mail($sendto, $subject, $message, $header);
echo "Mail Sent To . $loadMails[email] . 
";
}

?>

 

Link to comment
https://forums.phpfreaks.com/topic/71673-error-help/#findComment-360868
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.