jfs0479 Posted March 9, 2007 Share Posted March 9, 2007 Hi all, I have this script on my website which once to user registers with us that information is collected via $_POST and then added into the database. Plain and simple. But in another paart of that page i have a scipt which sends an email containing an activation link. However i am expereincing some problems becaause in the second php script on the page i uses this variable: $yourid = include("new_member_id.php"); which gets the last persons ID which has been added to the database. However the ID are auto assigned so i cant really alter them but in the confirmation email it sends it out as saying everyone's ID is just 1 and i cant seem to get over this??? I have noticed that on the page where the script is processed that the id seems to be appearing there but not in the email. Please can you help. A possible solution could be using another another way to include a file but i am unsure of that way! Thanks James This is the new members display script: <?php $useremail = $_POST["email1"]; $userfirstname = $_POST["firstname"]; $userlastname = $_POST["lastname"]; $yourpassword = $_POST["password1"]; $yourid = include("new_user_register.php"); //change this to your email. $to = "$useremail"; $from = "[email protected]"; $subject = "Thanks $userfirstname for Registering at Fly Blue Air!"; //begin message $message = <<<EOF <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Untitled Document</title> <style type="text/css"> <!-- .style1 { font-family: verdana; font-size: 11px; } --> </style> </head> <body> <table width="754" border="0" cellpadding="0" cellspacing="0"> <!--DWLayoutTable--> <tr> <td width="754" height="80" valign="top"><img src="http://www.flyblueair.com/main/email/images/logo.jpg" alt="logo" width="754" height="80"></td> </tr> <tr> <td height="5"></td> </tr> <tr> <td height="19" valign="top"><img src="http://www.flyblueair.com/main/email/images/header.jpg" width="754" height="19"></td> </tr> <tr> <td height="247" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#0A5ACD" class="style1"> <!--DWLayoutTable--> <tr> <td width="752" height="162" valign="top" bgcolor="#FFFFFF"><p>Dear $userfirstname,<br> On behlaf of all the pilots and staff at fly blue air i would like to take this moment to welcome you onboard this airline and would like to wish that you have a safe and wonderful time and experience. Below i have collected your details that you gave to us upon registration and compiled them for you just for a back-up copy just incase you forget. <br> <br><strong>Your Full Name: $userfirstname $userlastname<br> Your Identification Number : $yourid<br> Your Password: $yourpassword</strong></p> <p>As a form of validation we would request that you activate your account before you start any activites on the website. To activate your account please click the link below to allow you access to the crew area. </p> <p><a href="http://www.flyblueair.com/main/activate.php?pid=$yourid&lastname=$userlastname">http://www.flyblueair.com/main/activate.php?pid=$yourid&lastname=$userlastname</a></p> <p>Please ensure that you regularly check this email address becasue we will use it as your main point of contact unless notified otherwise. Please do not respond to this email as it not regulated.</p> <p>Regards,</p> <p>James Norman<br> <em>Cheif Executive</em> </p> <p><a href="http://www.flyblueair.com">www.flyblueair.net</a></p></td> </tr> </table></td> </tr> </table> </body> </html> EOF; //end of message $headers = "From: $from\r\n"; $headers .= "Content-type: text/html\r\n"; $to = "$to, $from"; // this will send to both emails at the same time. // now lets send the email. mail($to, $subject, $message, $headers); ?> Quote Link to comment https://forums.phpfreaks.com/topic/41990-solved-problem-showing-id/ Share on other sites More sharing options...
per1os Posted March 9, 2007 Share Posted March 9, 2007 Well without the included file it is hard to tell. My suggestion would be not to make $yourid=included file here as the reason the ID is always 1 is because include($file) returns a boolean if the file was included. Which it was included so it returned 1. Instead I would go about grabbing the ID this way. <?php #main file here $useremail = $_POST["email1"]; $userfirstname = $_POST["firstname"]; $userlastname = $_POST["lastname"]; $yourpassword = $_POST["password1"]; include('getUserId.php'); // Doing this includes the variable $yourid from the included file without needing to set the variable here. //...rest of text here <?php #get user id $yourid = mysql_ insert_ id($query); ?> Hope this helps. --FrosT Quote Link to comment https://forums.phpfreaks.com/topic/41990-solved-problem-showing-id/#findComment-203599 Share on other sites More sharing options...
jfs0479 Posted March 10, 2007 Author Share Posted March 10, 2007 Well below i have added the file that is included in the document where i get the latest persons id but i cant unsertstand where u want me to put the stuff u gave me! Thanks for the help. James <?php include("db.php"); $result = mysql_query( "select * from jfs0479_hindustan.bluepilots ORDER BY pid desc LIMIT 0 , 1");?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Untitled Document</title> </head> <body> <?php while ($row = mysql_fetch_assoc($result)) {?> <?php echo $row['pid'];?> <?php } ?> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/41990-solved-problem-showing-id/#findComment-204151 Share on other sites More sharing options...
jfs0479 Posted March 10, 2007 Author Share Posted March 10, 2007 Dont worry i have the probelm solved i just did what you said and used the mysql insert id function and it works!!!!!!! :) :) :) :) :) Thanks for your help! Quote Link to comment https://forums.phpfreaks.com/topic/41990-solved-problem-showing-id/#findComment-204158 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.