seephp Posted February 12, 2007 Share Posted February 12, 2007 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 Quote Link to comment https://forums.phpfreaks.com/topic/38232-solved-creating-mysql-database-script-help/ Share on other sites More sharing options...
trq Posted February 12, 2007 Share Posted February 12, 2007 Should be mysql_query not mysql_guery. Remove all the (@) error suppressors and you might actually see some errors. Quote Link to comment https://forums.phpfreaks.com/topic/38232-solved-creating-mysql-database-script-help/#findComment-183128 Share on other sites More sharing options...
redarrow Posted February 12, 2007 Share Posted February 12, 2007 <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> Quote Link to comment https://forums.phpfreaks.com/topic/38232-solved-creating-mysql-database-script-help/#findComment-183134 Share on other sites More sharing options...
seephp Posted February 12, 2007 Author Share Posted February 12, 2007 thank you! I got the script to work after a little other tweaking. Quote Link to comment https://forums.phpfreaks.com/topic/38232-solved-creating-mysql-database-script-help/#findComment-183138 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.