Jump to content

[SOLVED] Creating MySQL database script help


seephp

Recommended Posts

I have been writing a simple application that is sort of like a blogging engine. I have almost all of the code done(EXTREMELY simple) and something has gone wrong with the script that creates the database.

 

Here it is:

<html>
<head>
<link rel="stylesheet" type="text/css"
href="style.css" />
</head>
<body>
<?php
ini_set ('display_errors', 1);
error_reporting (E_ALL & ~E_NOTICE);

if ($dbc = @mysql_connect ('localhost', 'root', 'vertrigo')) {
print 'connected to MySQL!';

if (@mysql_guery ('CREATE DATABASE mysticky')) {
print 'You have created a database!';
} else {
die ('could not create the Database becuase: ' . mysql_error());
if (@mysql_select_db ('mysticky')) {
print 'The database has been selected!';
} else {
die('The database has not been selected because: ' . mysql_error() . 'Too bad!');
}
	mysql_close();
} else {
die('Could not connect to MySQL');
}
?>
</body>
</html>

 

my output has just been:

connected to MySQL

 

Help!

 

Thanks

<html>
<head>
<link rel="stylesheet" type="text/css"
href="style.css" />
</head>
<body>
<?php
ini_set ('display_errors', 1);
error_reporting (E_ALL & ~E_NOTICE);

if ($dbc = mysql_connect ('localhost', 'root', 'vertrigo')) {
print 'connected to MySQL!';

}elseif ( mysql_guery ('CREATE DATABASE mysticky')) {
print 'You have created a database!';

die ('could not create the Database becuase: ' . mysql_error());
}elseif (mysql_select_db ('mysticky')) {
print 'The database has been selected!';
} elseif 

die('The database has not been selected because: ' . mysql_error() . 'Too bad!');

}
	mysql_close();

else {
die('Could not connect to MySQL');
}

?>
</body>
</html>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.