kproc
04-08-2006, 08:52 AM
below is code that I have found by seaching google and I made a few changes to (db name, server) top match my web server provider.
It give me a message "Couldn't connect to MySQL" Which tells me ????
I beleive that it has something to do with tryingto call the data base, AS I have been able to connect with the information shown below ( for obvious reasons the password is not correct)
thank you
<html><head><title>Birthdays Create Table</title></head>
<body>
<?
$db="mydata_tomorrownextweek_com";
$link = mysql_connect("sqlc11.megasqlservers.com");
$pw = "mypassword";
$user = "dbm.tomorrownextweek.com";
if (! $link)
die("Couldn't connect to MySQL");
mysql_select_db($db, $user, $pw, $link)
or die("Select DB Error: ".mysql_error());
//create table
mysql_query("CREATE TABLE birthdays( id INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(id), name VARCHAR(30), birthday VARCHAR(7))")or die("Create table Error: ".mysql_error());
mysql_close($link);
?>
</body>
</html>
It give me a message "Couldn't connect to MySQL" Which tells me ????
I beleive that it has something to do with tryingto call the data base, AS I have been able to connect with the information shown below ( for obvious reasons the password is not correct)
thank you
<html><head><title>Birthdays Create Table</title></head>
<body>
<?
$db="mydata_tomorrownextweek_com";
$link = mysql_connect("sqlc11.megasqlservers.com");
$pw = "mypassword";
$user = "dbm.tomorrownextweek.com";
if (! $link)
die("Couldn't connect to MySQL");
mysql_select_db($db, $user, $pw, $link)
or die("Select DB Error: ".mysql_error());
//create table
mysql_query("CREATE TABLE birthdays( id INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(id), name VARCHAR(30), birthday VARCHAR(7))")or die("Create table Error: ".mysql_error());
mysql_close($link);
?>
</body>
</html>