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 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. 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> 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. 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
Archived
This topic is now archived and is closed to further replies.