tags:

views:

54

answers:

5

Here is the error message:

Fatal error: Call to undefined function mysql_connect() in /var/www/config.php on line 10

Below is the code:

<?php

ini_set('display_errors',1);
error_reporting(E_ALL|E_STRICT);

include('config.php');

// table name
$tbl_name=temp_members_db;

// Random confirmation code
$confirm_code=md5(uniqid(rand()));

// values sent from form
$name=$_POST['name'];
$email=$_POST['email'];
$country=$_POST['country'];

// Insert data into database
$sql="INSERT INTO $tbl_name(confirm_code, name, email, password, country)VALUES('$confirm_code', '$name', '$email', '$password', '$country')";
$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 confirmation link here";

// From
$header="from: your name <your email>";

// Your message
$message="Your Comfirmation link \r\n";
$message.="Click on this link to activate your account \r\n";
$message.="http://www.yourweb.com/confirmation.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";
}

?>php
+3  A: 

Your PHP installation was compiled without MySQL support. Either read the instructions for compiling PHP with MySQL, or contact your server administrators and find out why it's unavailable.

If you're using a pre-built bundle like WAMP or XAMPP, update your question with the appropriate tag to receive more specific help.

meagar
+1  A: 

You need to install MySQL and the PHP MySQL module.

SoftwareJonas
A: 

Did you install the mysql library for PHP?

Roberto Aloi
yes...i did....
abhi
A: 

check this site

http://www.somacon.com/p109.php

basically if im assuming everything is good in the config file there's been some misconfiguration so mysql isn't working properly

Breezer
could you please help me with the command...
abhi
if you follow the guide step by step you should be goodps. what os are u running your setup on?
Breezer
I have recompiled the php installation...However now i am getting the below error...
abhi
Notice: Use of undefined constant temp_members_db - assumed 'temp_members_db' in /var/www/signup_ac.php on line 10 Notice: Undefined index: name in /var/www/signup_ac.php on line 16 Notice: Undefined index: email in /var/www/signup_ac.php on line 17 Notice: Undefined index: country in /var/www/signup_ac.php on line 18 Cannot send Confirmation link to your e-mail addressphp
abhi
i am using ubuntu...
abhi
and what php version?the mysql error seemed to be solved now anywaysit looks like you have alot of other issues though
Breezer
i am using php5...
abhi
well those are just noticesadd or die (mysql_error ());after mysql_query($sql)so it looks like this$result=mysql_query($sql) or die (mysql_error ());
Breezer
A: 

look into your php.ini and search for that line:

extension=php_mysql_libmysql.dll

if you have a ; standing infront of the word extension in that very line like this:

;extension=php_mysql_libmysql.dll

remove the ; and restart apache/iis. Then it should work.

If the ; is not in foront of that line or that line doesn't exist then look into your php/ext/ folder if these two files exist:

php_mysql.dll
php_mysql_libmysql.dll

If they do exist then just put this line into yur php.ini and restart apache/iis:

extension=php_mysql_libmysql.dll

Otherwise you'll have to recompile php like my predecessors suggested

ITroubs