Hellusius Posted July 24, 2006 Share Posted July 24, 2006 I was reading through an tutorial about mysql and while doing so I also worked on the database, well I made it and now I wanted to create it on my frontpage I did the following in php[quote]<?phpinclude("header.php");?><?php$maps = mysql_connect();if (!$maps) { die('Could not connect: ' . mysql_error()); }$sql = "CREATE DATABASE maps_dp";if (mysql_query($sql,$maps)) { echo "Database maps_dp created"; }else { echo "Error creating database: " . mysql_error();mysql_close($maps);?><font size=4>Currect Map section</font></body></html>[/quote]And now my page doesn't load cause of the following error ???[quote]Parse error: syntax error, unexpected $end in /home/www/warnicro.awardspace.com/maps.php on line 27[/quote]any suggestions or am I doing something wrong, cause I am pretty new to this mysql and php Link to comment https://forums.phpfreaks.com/topic/15440-error/ Share on other sites More sharing options...
cmgmyr Posted July 24, 2006 Share Posted July 24, 2006 You didn't close your "else" statement with a } try that and see what happens.-Chris Link to comment https://forums.phpfreaks.com/topic/15440-error/#findComment-62585 Share on other sites More sharing options...
Hellusius Posted July 24, 2006 Author Share Posted July 24, 2006 that worked though I now strumbled on another problem which is [quote]Warning: mysql_connect(): Access denied for user 'warnicro'@'64.69.39.75' (using password: NO) on line 5Could not connect: Access denied for user 'warnicro'@'64.69.39.75' (using password: NO)[/quote]do I need to fill in the array or something of the mysql_connect? Link to comment https://forums.phpfreaks.com/topic/15440-error/#findComment-62590 Share on other sites More sharing options...
cmgmyr Posted July 24, 2006 Share Posted July 24, 2006 yes, fill it in like this: mysql_connect("server", "username", "password")-Chris Link to comment https://forums.phpfreaks.com/topic/15440-error/#findComment-62604 Share on other sites More sharing options...
Hellusius Posted July 24, 2006 Author Share Posted July 24, 2006 does the server name need to match anything in particulair like my own pasword? Link to comment https://forums.phpfreaks.com/topic/15440-error/#findComment-62623 Share on other sites More sharing options...
cmgmyr Posted July 24, 2006 Share Posted July 24, 2006 usually the server would be localhost Link to comment https://forums.phpfreaks.com/topic/15440-error/#findComment-62773 Share on other sites More sharing options...
Hellusius Posted July 26, 2006 Author Share Posted July 26, 2006 The page loads now but I get an error at he top saying[code]Error creating database: Access denied for user 'warnicro_01'@'64.69.39.75' to database 'maps_dp' [/code]the code looks like this[code]<?phpinclude("header.php");?><?php$sql = 'INSERT INTO `db1` (`Maps`) VALUES (\'1\')';$maps = mysql_connect("db5.awardspace.com","warnicro_01","E23V24");if (!$maps) { die('Could not connect: ' . mysql_error()); }$sql = "CREATE DATABASE maps_dp";if (mysql_query($sql,$maps)) { echo "Database maps_dp created"; }else { echo "Error creating database: " . mysql_error($maps);mysql_close($maps); }?><font size=4>Currect Map section</font></body></html>[/code] Link to comment https://forums.phpfreaks.com/topic/15440-error/#findComment-63754 Share on other sites More sharing options...
fenway Posted July 26, 2006 Share Posted July 26, 2006 Sounds like the login credentials are incorrect. Link to comment https://forums.phpfreaks.com/topic/15440-error/#findComment-63768 Share on other sites More sharing options...
Hellusius Posted July 26, 2006 Author Share Posted July 26, 2006 I think I have a problem with creating rows and collums Link to comment https://forums.phpfreaks.com/topic/15440-error/#findComment-63783 Share on other sites More sharing options...
fenway Posted July 26, 2006 Share Posted July 26, 2006 Maybe, but not based on the error you provided. Link to comment https://forums.phpfreaks.com/topic/15440-error/#findComment-63842 Share on other sites More sharing options...
Hellusius Posted July 26, 2006 Author Share Posted July 26, 2006 well I don't actually know how to add a collum, here is the phpadminpage[attachment deleted by admin] Link to comment https://forums.phpfreaks.com/topic/15440-error/#findComment-63898 Share on other sites More sharing options...
fenway Posted July 26, 2006 Share Posted July 26, 2006 There's the "add N new field(s)" option.. but still, it doesn't seem like you're connecting properly in your PHP script. Link to comment https://forums.phpfreaks.com/topic/15440-error/#findComment-64102 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.