Jump to content

Multi Data Insert based on X number of Returned Recpients - PHP


TRI0N

Recommended Posts

Okay here is the deal.  Fist if somone selects ALL from the Recpient field of a memo form it will extract all the people in the employees database.

 

$recpient = $_REQUEST['recpient'] ;

$subject = $_REQUEST['subject'] ;

$body = $_REQUEST['body'] ;

$ip_record = $REMOTE_ADDR ;

$from = $firstname." ".$lastname ;

 

if ($recpient == 'ALL') {

  $result3 = mysql_query("SELECT distinct * FROM employees") ;

  while($row = mysql_fetch_row($result3)) {

  $recpient = $row[0] ;

  mysql_query("INSERT INTO memos VALUES('NULL','$date3','$time','$recpient','$from','$subject','$body','0','$ip_record')") OR die(mysql_error());

 

  // Close Database Connection

  mysql_close();

  }

}

 

Does this code look correct?

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.