Categories:
.NET (357)
C (330)
C++ (183)
CSS (84)
DBA (2)
General (7)
HTML (4)
Java (574)
JavaScript (106)
JSP (66)
Oracle (114)
Perl (46)
Perl (1)
PHP (1)
PL/SQL (1)
RSS (51)
Software QA (13)
SQL Server (1)
Windows (1)
XHTML (173)
Other Resources:
How To Connect to MySQL Severs with User Accounts
How To Connect to MySQL Severs with User Accounts? - MySQL FAQs - PHP Connections and Query Execution
✍: FYIcenter.com
If you want to connect a MySQL server with user account name and password, you need to call mysql_connect() with more parameters like this:
$con = mysql_connect($server, $username, $password);
If your MySQL server is provided by your Internet service company, you need to ask them what is the server hostname, port number, user account name and password. The following tutorial exercise shows you how to connect to a MySQL server, on host "localhost", at port "8888", with user account "dev", and with password "iyf":
<?php
$con = mysql_connect('localhost:8888', 'dev', 'iyf');
if (!$con) {
print("There is a problem with MySQL connection.\n");
} else {
print("The MySQL connection object is ready.\n");
mysql_close($con);
}
?>
If all parameters are correct, you should get a good connection object as shown in the following output:
The MySQL connection object is ready.
2007-05-10, 5443👍, 0💬
Popular Posts:
Can Two Forms Be Nested? - XHTML 1.0 Tutorials - Understanding Forms and Input Fields Can two forms ...
How Many Tags Are Defined in HTML 4.01? There are 77 tags defined in HTML 4.01: a abbr acronym addre...
How to reduce the final size of an executable file? Size of the final execuatable can be reduced usi...
How To Decrement Dates by 1? - MySQL FAQs - Introduction to SQL Date and Time Handling If you have a...
Where Do You Download JUnit? Where do I download JUnit? I don't think anyone will ask this question ...