Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Connecting to MySql

Status
Not open for further replies.

rpbenito

Programmer
Jun 13, 2001
63
US
I am writing a Db for a project...how exactly do you connect to MySql via Php? Thanks a lot.
 
i have a bit of simple code you can hack.

<?

$hostname = &quot;yoursite.com&quot;; // Host name.
$username = &quot;username&quot;; // Your database login name
$password = &quot;password&quot;; // Your database password.
$usertable = &quot;users&quot;; // Table name.
$dbName = &quot;tablename&quot;; // Database name.


MYSQL_CONNECT($hostname, $username, $password) OR DIE(
&quot;Unable to connect to database&quot;);
@mysql_select_db( &quot;$dbName&quot;) or die( &quot;Unable to select database&quot;);
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top