Announcements | Last Post | |
---|---|---|
SoC Curricula | 09/30/2017 01:08PM | |
Demarcation or scoping of examinations and assessment | 02/13/2017 07:59AM | |
School of Computing Short Learning Programmes | 11/24/2014 08:37AM | |
Unisa contact information | 07/28/2011 01:28PM |
last minute questions October 28, 2012 08:30PM |
Registered: 11 years ago Posts: 29 Rating: 0 |
Language: PHP<?PHP $cname = $_POST[';cname';]; $SQL = "SELECT * FROM course WHERE course.cid =';$cname';"; $result = mysql_query($SQL); $numRows = mysql_num_rows($result); $boolLastRow = mysql_data_seek($result, ($numRows - 1)); $row = mysql_fetch_row($result); $cID = $row[0]; $cID++; $course_id = $cID; $st_no = "SELECT * FROM student WHERE student.cid =';$cname';"; $db_handle = mysql_connect("localhost", "root" , "") or die("Could not connect: " . mysql_error()); mysql_select_db(';registration';, $db_handle) or die(mysql_error()); $studentsql = "INSERT INTO student (sname, init, fname, title, msname, dob, gen, lang, idno, telh, telw, cel, fax, email, address) VALUES (';$_POST[sname]';,';$_POST[init]';,';$_POST[fname]';,';$_POST[title]';,';$_POST[msname]';,';$_POST[dob]';,';$_POST[gen]';,';$_POST[lang]';,';$_POST[idno]';,';$_POST[telh]';,';$_POST[telw]';,';$_POST[cel]';,';$_POST[fax]';,';$_POST[email]';,';$_POST[address]';)"; $result = mysql_query($studentsql) or die("Invalid query: " . mysql_error()); $studentsql = "INSERT INTO course_student (sno, cid) VALUES (';$st_no';, ';$course_id';)"; $result = mysql_query($studentsql) or die("Invalid query: " . mysql_error()); if($result){ echo("<br>Data input is successfull"); } else{ echo("<br>Data input has failed"); } ?>
Re: last minute questions October 29, 2012 07:28AM |
Admin Registered: 18 years ago Posts: 10,001 Rating: 353 |
Language: PHP//sql query to get course names and course ids <input type=checkbox.... name=<?php echo "$course_name"; ?> value="$cid";?>...>
Re: last minute questions October 29, 2012 11:11AM |
Registered: 11 years ago Posts: 29 Rating: 0 |
Re: last minute questions October 29, 2012 11:13AM |
Registered: 11 years ago Posts: 78 Rating: 0 |
Re: last minute questions October 30, 2012 02:41PM |
Registered: 11 years ago Posts: 100 Rating: 0 |
Language: PHPfunction send_email($idno){ //send email to new student $sql_email_student = "SELECT fname, sname, email FROM student WHERE idno = ';$idno';"; $result = mysql_query($sql_email_student) or die(mysql_error()); while ($row = mysql_fetch_array($result)){ $to_student = $row[';email';]; $from = "admin@yournisa.co.za"; $subject = "Welcome"; $headers = "From: ".$from." "; $message = "Welcome $row[fname] $row[sname] to yournisa. We hope you would excel to your greatest potential!"; } mail($to_student, $subject, $message, $headers); //send the updates to the rest of the students. $sql_email_class = "SELECT fname, sname, email FROM student"; $result_email_class = mysql_query($sql_email_class); $sql_shared = "SELECT fname, sname, email FROM student WHERE contact_flag = ';Y';"; $result_shared = mysql_query($sql_shared); $message_class = ""; while ($row_class = mysql_fetch_array($result_email_class)){ $message_class = ""; $to = $row_class[';email';]; $from = "admin@yournisa.co.za"; $subject = "Class information"; $headers = "From: ".$from." "; $message_class = "Hi $row_class[fname] $row_class[sname] </br>". "</br> Below is an updated list of your class mates</br>"; while ($row_shared = mysql_fetch_array($result_shared)){ $message_class .= "$row_shared[fname] $row_shared[sname] $row_shared[email] </br>"; } $message .= "Kind Regards </br>". "The Yournisa Team </br>"; mail($to, $subject, $message, $headers); } }
Re: last minute questions October 30, 2012 03:05PM |
Admin Registered: 18 years ago Posts: 10,001 Rating: 353 |
Language: PHPrequire("class.phpmailer.php"); $mail = new PHPMailer(); $mail->IsMail(); $mail->AddAddress($email); //$email from db query for example $mail->IsHTML(true); // if there is HTML in your email $mail->From="$from_email"; $mail->FromName="$sender_name"; $mail->Sender="$from_email"; // indicates ReturnPath header $mail->AddReplyTo("$from_email", "$from_email"); // indicates ReplyTo headers $mail->MsgHTML(true); // if there is HTML in your email $mail->AddCC("jonny@there.com", "$other"); echo "<br>The following Email has been send to $manager_name ($man_email) at <strong>$club</strong> :<br><br>"; $body ="add body"; $body .="add more body"; $mail->Subject="Request"; echo "$body"; // just to see what is sent $mail->Body = $body; if(!$mail->Send()) { echo "Error sending: " . $mail->ErrorInfo;; } else { echo "Sent!"; mysql_query here // insert a record of the sent email into a db } $mail->ClearAddresses();
Re: last minute questions October 30, 2012 03:18PM |
Registered: 11 years ago Posts: 100 Rating: 0 |