Hi, There are some errors in your code.
1. The name of the database can not
login. The name of the database always includes the name of the user. Is the name of your database "a8915655_login?
adforbind.php
PHP Code:
<?php
$mysql_host = "mysql7.000webhost.com";
// Begin code incorrect
$mysql_database = "login"; // End code incorrect
$mysql_user = "a8915655_geo";
$mysql_password = "****";
mysql_connect($mysql_host,$mysql_user,$mysql_password) or die(mysql_error());
mysql_select_db($mysql_database)or die;
?>
2. To access the contents of the variable $ _POST array should quote the name of the variable.
You write the following:
PHP Code:
bruger=$_POST[bruger]
And it would be more correct to write:
PHP Code:
bruger=$_POST['bruger']
PHP Code:
<?php
if (isset($_POST['Gem']))
{
if (mysql_result(mysql_query("SELECT bruger FROM login WHERE bruger=$_POST['bruger']"),0) > 0)
{
echo 'Brugernavnet findes allerede!';
}
else
{
mysql_query("INSERT INTO login (bruger,pass,rang) VALUES ('$_POST['bruger']',MD5('$_POST['pass']'),'$_POST['rang']')") or die(mysql_error());
echo 'Brugeren er blevet tilføjet!';
}
}
?>