|
|
|
#1 (permalink) |
|
Messages: n/a
Hébergeur: |
After my data passes all validation I load it into the db
Now I need that record Id so that I can send it in an email for registration purposes. I am using the following to read that info: //code: //**************************************** $check = mysql_query("SELECT username, id FROM user WHERE username = '$userName'")or die(mysql_error()); //Gives error if user dosen't exist $check2 = mysql_num_rows($check); if ($check2 == 0) { die('That user does not exist in our database. '); } while($info = mysql_fetch_array( $check )){ $dbUserName = stripslashes($info['username']); //gives error if the password is wrong if ($userName != $dbUserName) { die('This user has not registered yet!'); } else{ $userId = $info['id']; } } //end code //********************************************** I fail on the check $check2 = mysql_num_rows($check); if ($check2 == 0) { die('That user does not exist in our database. '); } Is the logic wrong? But the logic below passes but when I pass the id in the email link there is no data in the variable if ($userName != $dbUserName) { die('This user has not registered yet!'); } else{ $userId = $info['id']; } } when I put the following code in a function it won't send and I get the header error when I use header(location: ) //email code //************************************************** require("php/class.phpmailer.php"); $mail = new PHPMailer(); //$mail->IsSMTP(); // set mailer to use SMTP $mail->Host = "relay-hosting.securesever.net"; // SMTP servers $mail->Port = 3535; $user = $_POST['fName'] . " " . $_POST['lName']; $mail->From = $_POST['email']; $mail->FromName = $user; $mail->AddAddress("kraleigh@sbcglobal.net", "Kevin Raleigh"); //$mail->AddAddress("ellen@example.com"); // name is optional //$mail->AddReplyTo("info@example.com", "Information"); // set word wrap to 50 characters $mail->WordWrap = 50; // add attachments //$mail->AddAttachment("/var/tmp/file.tar.gz"); //$mail->AddAttachment("/tmp/image.jpg", "new.jpg"); // optional name $mail->IsHTML(true); $myEmail = $_POST['email']; // set email format to HTML $mail->Subject = "Registration for". $user; $emailString = "http://www.1purpose-bethel.org/validate?id=" . $info['id'] .. "&code=" . $secureID; $myBody = "Registrant: $user <br/>"; $myBody .= "Email: $myEmail<br/>"; $myBody .= "<br/><br/><br />"; $myBody .= "$emailString"; $mail->Body = $myBody; $mail->AltBody = "This is the body in plain text for non-HTML mail clients"; if(!$mail->Send()) { echo "Message could not be sent. <p>"; echo "Mailer Error: " . $mail->ErrorInfo; exit; } //header('Location: success.php'); ?> <script language="javascript">window.location="success.php "</script> <?php //end code email //************************************************** ***********8 I get the $secureID variable value but not the $info['id'] value insight would be appreciated thank you Kevin |
|
|
|
#2 (permalink) |
|
Messages: n/a
Hébergeur: |
"Kevin Raleigh" <kraleigh@sbcglobal.net> wrote in message
news:h6qdnQqVnN48IwfbnZ2dnUVZ_sWdnZ2d@giganews.com ... > After my data passes all validation I load it into the db > Now I need that record Id so that I can send it in an email for > registration check the PHP manual for mysql_insert_id() |
|
|
|
#3 (permalink) |
|
Messages: n/a
Hébergeur: |
Thank You
Kevin "Virginner" <theDOTbin@virginLOSEIT.net> wrote in message news:XEHmi.8888$XR.5300@newsfe4-win.ntli.net... > "Kevin Raleigh" <kraleigh@sbcglobal.net> wrote in message > news:h6qdnQqVnN48IwfbnZ2dnUVZ_sWdnZ2d@giganews.com ... > > After my data passes all validation I load it into the db > > Now I need that record Id so that I can send it in an email for > > registration > > check the PHP manual for > > mysql_insert_id() > > > |
|
![]() |
| Outils de la discussion | |
|
|