0

hi everuone i have website but i cant connect to database for login & register how can i connect? here my code

<?php
$connect=mysql_connect("184.154.164.202","ahmedhay_royal","xxxxxxx") or die("couldnt connect to data base:".mysql_error());
mysql_select_db("ahmedhay_login",$connect) or die ("couldnt find data base");

?>
4
Contributors
16
Replies
80
Views
4 Years
Discussion Span
Last Post by aisha.edris1
0

they show me this error
Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'ahmedhay_royal'@'server2.websitehostserver.net' (using password: YES) in /home/ahmedhay/public_html/dbc.php on line 2
couldnt connect to data base:Access denied for user 'ahmedhay_royal'@'server2.websitehostserver.net' (using password: YES)

0

If you are running this code on your webhost, then try "localhost" instead of the IP address. If you are running this elsewhere, you may not have priviliges to access your MySQL remotely. Ask your webhost.

0

thanx alot but i havr manyyy error after login but i test it in wamp server ti work why in my website not working?

0

Access denied for user 'ahmedhay_royal'@'server2.websitehostserver.net'

Change the user to the correct one, with the right password, and change the server to localhost.

1

It also happened to me.

Try putting this to your mysql.ini
In the SERVER SECTION, under [mysqld],add this line

skip-grant-tables

Edited by imBaCodes: wrong answer

0

hi now my websit is work now only my register.php how can i fix it?here my code

<?php
error_reporting(0);
   if($_POST['submit'])
{
  $fullname=mysql_real_escape_string($_POST['fullname']);
  $username=mysql_real_escape_string($_POST['username']);
  $password=mysql_real_escape_string($_POST['password']);
  $password1=mysql_real_escape_string($_POST['password1']);
$enc_Password=md5($password);
if($fullname && $username &&$password &&$password1)
   {
   if(strlen($fullname)>30)

   {
   echo "your name is too long";
   }
   if(strlen($username)>30)
   {
      echo "your username is too long";
   }
   else
   {
   if(strlen($password)>15 || strlen($password)<6)
   {
      echo "your password must be btween 6 and 15 character";
   }
   if($password == $password1)
   {
       require "dbc.php";
       $query = mysql_query("INSERT INTO tala  VALUES (NULL, '$fullname', '$username', '$enc_Password')") or die(mysql_error());

      die(  header("location: index.php"));
   }
   else
   {
   echo "password must match";
   }
   }
   }
   else
   echo "all fileds are required";
}
?>
0

so what i have to write?by the way i didn't insert password1 in my database only
password varchar(30)

0

Yes my first problem it solved but my register doesn't workkk and i must deliver my project tomorrow to my super viser i don't know what i have suppose to do to solve this problem???

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.