Why do I get this error message

When I test in the browser it shows the error message.

Insert Data Into mySQL Database
Name :
Lastname :
Email :
<?php $host="1"; // Host name $username="e"; // Mysql username $password="I"; // Mysql password $db_name="e"; // Database name $tbl_name="Members"; // Table name // Connect to server and select database. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); // Get values from form $name=$_POST['name']; $lastname=$_POST['lastname']; $email=$_POST['email']; // Insert data into mysql $sql="INSERT INTO $tbl_name(name, lastname, email)VALUES('$name', '$lastname', '$email')"; $result=mysql_query($sql); // if successfully insert data into database, displays message "Successful". if($result){ echo "Successful"; echo "
"; echo "Back to main page"; } else { echo "ERROR"; } // Turn off all error reporting error_reporting(0); // Report simple running errors error_reporting(E_ERROR | E_WARNING | E_PARSE); // Reporting E_NOTICE can be good too (to report uninitialized // variables or catch variable name misspellings ...) error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE); // Report all errors except E_NOTICE // This is the default value set in php.ini error_reporting(E_ALL ^ E_NOTICE); // Report all PHP errors (see changelog) error_reporting(E_ALL); // Report all PHP errors error_reporting(-1); // Same as error_reporting(E_ALL); ini_set('error_reporting', E_ALL); // close connection mysql_close(); ?>

Also it is not inserting into the database. I already tried a test to add a table it worked okay but now I am not able to insert into the database. All my host,un,pwd,db are correct. Any ideas.

I see I get this message now

What can I do to fix it.

Can’t connect to MySQL server on ‘localhost’ (10061)

Sponsor our Newsletter | Privacy Policy | Terms of Service