PDA

View Full Version : Users who need help connecting to MySQL


Atomic-Design
3-28-02, 04:12 PM
Hi, this isn't a question, but I'm posting this to help people out. So you need to connect to mySQL? Try this:

<?php
$link = mysql_connect("localhost","USER","PASSWORD");
if (!$link)
die ("Couldn't connect to MySQL");
if ($link)
print "Yay!";

$database = "DB NAME";
mysql_select_db($database) or die ("Couldn't open database");
?>

The USER is the 2nd column on the MySQL page. It isn't the top column. The password is whatever you specified for that user.

The DB NAME is the 1st colun in the MySQL Members Operation Page. You can only have 1 MySQL Database.

Hope this helps!