Code: $DBC = Mysqli_connect (' localhost ', ' Tom ', ' 123123 ', ' aliendatabase ')
Or Die (' Error connecting to MySQL server. ');
Also separates the database one MDF and one LDF file in the same folder.
But the test still went wrong, as if the SQL Server location could not be connected:
Warning:mysqli_connect () [Function.mysqli-connect]: (hy000/2003): Can ' t connect to MySQL server on ' localhost ' (10061) in E:\Learing\phpWeb\aliens\report.php on line 22
Error connecting to MySQL server.
I am using Microsoft SQL Server 2005, my SQL is connected to the server, the user name and password is not wrong. Solving.
Reply to discussion (solution)
You're using Microsoft Microsoft SQL, and you're using mysqli to connect to the connection.
Mssql_connect
Little brother just learned PHP, a lot of do not understand. Trouble the Great God to help me see again, I changed after still is wrong.
$DBC = mysql_connect (' localhost ', ' Tom ', ' 123123 ', ' aliendatabase ')
Or Die (' Error connecting to MySQL server. ');
$query = "INSERT into Aliens_abduction (first_name, last_name, when_it_happened, How_long,".
"How_many, Alien_description, What_they_did, fang_spotted, other, email)".
"VALUES (' $first _name ', ' $last _name ', ' $when _it_happened ', ' $how _long ', ' $how _many ',".
"' $alien _description ', ' $what _they_did ', ' $fang _spotted ', ' $other ', ' $email ')";
$result = mysql_query ($dbc, $query)
Or Die (' Error querying database. ');
Mysql_close ($DBC);
Warning:mysql_connect () [Function.mysql-connect]: Can ' t connect to MySQL server on ' localhost ' (10061) in E:\Learing\phpW eb\aliens\report.php on line 22
Error connecting to MySQL server.