pnkgirl25 Posted August 24, 2007 Share Posted August 24, 2007 Warning: mysql_query(): Can't connect to local MySQL server through socket '/usr/local/mysql-5.0/data/mysql.sock' (2) in /home/content/f/o/c/focusevents/html/signup_ac.php on line 20 Warning: mysql_query(): A link to the server could not be established in /home/content/f/o/c/focusevents/html/signup_ac.php on line 20 Not found your email in our databaseCannot send Confirmation link to your e-mail address <? $host="******"; // Host name $username="******"; // Mysql username $password="******"; // Mysql password $db_name="****"; // Database name // table name $tbl_name="temp_members_db"; // Random confirmation code $confirm_code=md5(uniqid(rand())); // values sent from form $firstname=$_POST['firstname']; $lastname=$_POST['lastname']; $email=$_POST['email']; $weddingdate=$_POST['weddingdate']; $username=$_POST['username']; $password=$_POST['password']; // Insert data into database $sql="INSERT INTO $tbl_name(confirm_code, firstname, lastname, email, weddingdate, username, password)VALUES('$confirm_code', '$firstname', '$lastname', '$email', '$weddingdate', '$username', '$password')"; $result=mysql_query($sql); // if suceesfully inserted data into database, send confirmation link to email if($result){ // ---------------- SEND MAIL FORM ---------------- // send e-mail to ... $to=$email; // Your subject $subject="Your One Spot confirmation link"; // From $header="from: One Spot <your email>"; // Your message $message="Thank you for joining One Stop\r\n"; $message="To activate your account please click on the link bellow\r\n"; $message.="Click on this link to activate your account \r\n"; $message.="http://www.yourweb.com/confirm.php?passkey=$confirm_code"; // send email $sentmail = mail($to,$subject,$message,$header); } // if not found else { echo "Not found your email in our database"; } // if your email succesfully sent if($sentmail){ echo "Your Confirmation link Has Been Sent To Your Email Address."; } else { echo "Cannot send Confirmation link to your e-mail address"; } ?> Mod edit: db connection variable removed for security. Quote Link to comment https://forums.phpfreaks.com/topic/66536-solved-help-wih-error-code/ Share on other sites More sharing options...
chocopi Posted August 24, 2007 Share Posted August 24, 2007 You haven't made a connection to the database, you have specified the $host,$username,$password and $db_name (which you should have blanked out, but oh well) but havent connected. After those four variables you need: <?php $con = mysql_connect($host,$username,$password) or die(mysql_error()); mysql_select_db($db_name) or die(mysql_error()); ?> mysql_connect and mysql_select_db Hope that helps, ~ Chocopi Quote Link to comment https://forums.phpfreaks.com/topic/66536-solved-help-wih-error-code/#findComment-333213 Share on other sites More sharing options...
phporcaffeine Posted August 24, 2007 Share Posted August 24, 2007 If you'd like to do it in a factored way: replace this: $host="*************"; // Host name $username="***********r"; // Mysql username $password="*********"; // Mysql password $db_name="***********"; // Database name with this: mysql_select_db("************", mysql_connect("**********.*******.net", "***********", "************")); Quote Link to comment https://forums.phpfreaks.com/topic/66536-solved-help-wih-error-code/#findComment-333232 Share on other sites More sharing options...
ober Posted August 24, 2007 Share Posted August 24, 2007 It would be wise not to share all your connection details. Quote Link to comment https://forums.phpfreaks.com/topic/66536-solved-help-wih-error-code/#findComment-333250 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.