Jump to content


Photo

error


  • Please log in to reply
11 replies to this topic

#1 Hellusius

Hellusius
  • Members
  • PipPipPip
  • Advanced Member
  • 55 posts

Posted 24 July 2006 - 12:34 AM

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

<?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>


And now my page doesn't load cause of the following error  ???


Parse error: syntax error, unexpected $end in /home/www/warnicro.awardspace.com/maps.php on line 27


any suggestions or am I doing something wrong, cause I am pretty new to this mysql and php



#2 cmgmyr

cmgmyr
  • Members
  • PipPipPip
  • Advanced Member
  • 1,278 posts
  • LocationUSA

Posted 24 July 2006 - 12:37 AM

You didn't close your "else" statement with a } try that and see what happens.

-Chris

#3 Hellusius

Hellusius
  • Members
  • PipPipPip
  • Advanced Member
  • 55 posts

Posted 24 July 2006 - 12:42 AM

that worked though I now strumbled on another problem which is

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)


do I need to fill in the array or something of the mysql_connect?

#4 cmgmyr

cmgmyr
  • Members
  • PipPipPip
  • Advanced Member
  • 1,278 posts
  • LocationUSA

Posted 24 July 2006 - 01:16 AM

yes, fill it in like this: mysql_connect("server", "username", "password")

-Chris

#5 Hellusius

Hellusius
  • Members
  • PipPipPip
  • Advanced Member
  • 55 posts

Posted 24 July 2006 - 02:39 AM

does the server name need to match anything in particulair like my own pasword?

#6 cmgmyr

cmgmyr
  • Members
  • PipPipPip
  • Advanced Member
  • 1,278 posts
  • LocationUSA

Posted 24 July 2006 - 12:21 PM

usually the server would be localhost

#7 Hellusius

Hellusius
  • Members
  • PipPipPip
  • Advanced Member
  • 55 posts

Posted 26 July 2006 - 12:51 AM

The page loads now but I get an error at he top saying

Error creating database: Access denied for user 'warnicro_01'@'64.69.39.75' to database 'maps_dp'

the code looks like this

<?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>


#8 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 26 July 2006 - 01:39 AM

Sounds like the login credentials are incorrect.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.

#9 Hellusius

Hellusius
  • Members
  • PipPipPip
  • Advanced Member
  • 55 posts

Posted 26 July 2006 - 02:23 AM

I think I have a problem with creating rows and collums

#10 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 26 July 2006 - 06:22 AM

Maybe, but not based on the error you provided.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.

#11 Hellusius

Hellusius
  • Members
  • PipPipPip
  • Advanced Member
  • 55 posts

Posted 26 July 2006 - 10:05 AM

well I don't actually know how to add a collum, here is the phpadminpage

[attachment deleted by admin]

#12 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 26 July 2006 - 03:32 PM

There's the "add N new field(s)" option.. but still, it doesn't seem like you're connecting properly in your PHP script.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users