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
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
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
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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.