Jump to content

Archived

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

Hellusius

error

Recommended Posts

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]
<?php
include("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

Share this post


Link to post
Share on other sites
You didn't close your "else" statement with a } try that and see what happens.

-Chris

Share this post


Link to post
Share on other sites
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 5
Could 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?

Share this post


Link to post
Share on other sites
yes, fill it in like this: mysql_connect("server", "username", "password")

-Chris

Share this post


Link to post
Share on other sites
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]<?php
include("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]

Share this post


Link to post
Share on other sites
Sounds like the login credentials are incorrect.

Share this post


Link to post
Share on other sites
Maybe, but not based on the error you provided.

Share this post


Link to post
Share on other sites
well I don't actually know how to add a collum, here is the phpadminpage

[attachment deleted by admin]

Share this post


Link to post
Share on other sites
There's the "add N new field(s)" option.. but still, it doesn't seem like you're connecting properly in your PHP script.

Share this post


Link to post
Share on other sites

×

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.