Re: grabbing data and auto email set users

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Okay I have the emails to work now, thanks so much Chris.  But now I have encountered another problem, I hope you don't mind helping, I am obviously missing again something basic.  Basic than before.
   
  I have this code:
   
  $result = mysql_query("SELECT `nickname`  FROM tipping
WHERE 1
ORDER BY `score`
DESC LIMIT 0, 30",$db);
  while ($myrow = mysql_fetch_row($result)) {
                  printf("
<br><input type=text name=username[$a] value=%s> <br>",
                $myrow[0]);
  }
  ?>
   
  which displays all the users names.
   
  than I want to push it to another page that tells the db to update, one username per record.  Code below:
   
    $query = "insert into round3 SET username='$username[$a]'";
            mysql_query("$query");
            echo(" ");
}
      else {echo("Ooops, something bad happened!  Please try again shortly.");}
  ?>
  <a href="admin.php">BACK</a>

  <input type="submit" value="submit">
</form>
</p>
   
  But when I check the db this is what I get.
   
  A new record created but username is blank.
   
  So it's creating a new record but leaving it blank, why?
   
  Now at times the record will insert more than one record, so I need it able to update more than one record at a time.
   
  Any help?
   
  J


Chris <dmagick@xxxxxxxxx> wrote:
  JeRRy wrote:
> Hi,
> 
> Ahh okay I thought NULL was blank. Okay I understand, therefore, hehe, 
> I fixed it.
> 
> 
> 
> $query = "select username from round3 where misc=''";
> 
> fixed it, the email got sent. 
> 
> Had to change a few strings also to match my database which I was not 
> aware of. Forgot it actually.
> 
> Now the only thing I need to know is how do I change the sender email 
> is, currently it sets to the server default username. (e.g. 
> username@xxxxxxxxxxxxxx ) Is there a 
> way to change that and the subject.

You set the subject:

mail($to, $subject, $message, $headers);

You can set the "From" in the headers:

$headers = "From: your_email_address\n";
$headers .= "Reply-To: your_email_address\n";

See http://www.php.net/mail for more info.

-- 
Postgresql & php tutorials
http://www.designmagick.com/


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux