Hi, when I run my code I get an error saying:
Warning: 1 is not a MySQL result index in h:\inetpub\wwwroot\supracore\onecardexpress\temp17\webformsent.php on line 36
which is right where my while statement begins.
can anyone help?
<?
include("dataincludes/connect.inc");
/ SEND TO ALL PEOPLE /
if ($Type == "All") {
$result = mysql_query("SELECT Username, Fname, Lname, Email FROM Subscriber WHERE Referer = '$Loginusername'");
if (!$result) { echo("<P>Error performing query: ' . mysql_error() . '</P>"); exit();}
while ($row = mysql_fetch_array($result)) {
$Tofname = $row["Fname"];
$Tolname = $row["Lname"];
$Toemail = $row["Email"];
$Tousername = $row["Username"];
$to = "$Toemail"; / Change this, obviously. /
$from = "From: $Fname $Lname <$Email>";
$subject = "$Subject";
$body = "Dear $Tofname $Tolname,\n\nThis is to everyone.";
/ Mail the message. /
mail($to,$subject,$body,$from);
/ DATE LAST EMAIL SENT TO PERSON /
$result = mysql_query("UPDATE Subscriber SET Last_Email_Sent = '$today', Last_Email_Template = '$Emailtemplate' WHERE Username = '$Tousername'");
if (!$result) { echo("<P>Error performing query: " . mysql_error() . "</P>"); exit();}
}
mysql_close();
}