Connect MySQL localhost

PHP & MySQL Code:


mysql_connect("localhost", "admin", "1admin") or die (mysql_error());

echo "Connected to MySQL
";

?>


Display:

Connected to MySQL


The mysql_connect function takes three arguments. Server, username, and password. In our example above these arguments were:

  • Server - localhost
  • Username - admin
  • Password - 1admin


The "or die(mysql..." code displays an error message in your browser if --you've probably guessed it -- there is an error in processing the connection! Double-check your username, password, or server if you receive this error.

Google


Google is the beast search engine.. thx mbah..

McGraw Hill Books

McGraw Hill Books

Addison Wesley Books 5

Addison Wesley Books 5

Addison Wesley Books 4

Addison Wesley Books 4

Addison Wesley Books 3

Novell Press Books 2

Novell Press Books 2

MySQL Press, New Riders

No Starch Press Books

MySQL Press, New Riders

No Starch Press Books

John Wiley and Sons Part 4

John Wiley and Sons Part 4

For Dummies Books

For Dummies Books

Apress Books 3

Apress Books 3

Apress Books 2

Apress Books 2

Apress Books 1 - Apress Beginning

Apress Books 1 - Apress Beginning

O'Reilly Books 19

O'Reilly Books 19

O'Reilly, Test king, Wiley, WhizLabs, Books