Hello, like before, I'm still trying to make a register page with login and logout.

Here's the link to my server (If I'm not allowed to share links please remind me.)
http://fifarulez.dyndns.org/hacks4all.wapzan.com/registration/
After the registration it will give 2 warnings.

( ! ) Warning: mysql_query() [function.mysql-query]: Access denied for user ''@'localhost' (using password: NO) in C:\wamp\www\hacks4all.wapzan.com\registration\register.php on line 40

and

( ! ) Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in C:\wamp\www\hacks4all.wapzan.com\registration\register.php on line 40

I tried to fix it by changing the code in:

// dbConfig.php is a file that contains your
    // database connection information. This
    // tutorial assumes a connection is made from
    // this existing file.
    include ("dbConfig.php");

by

// Replace the variable values below
    // with your specific database information.
    $host = "localhost";
    $user = "root";
    $pass = "CENSORED";
    $db = "CENDORED";
     
    // This part sets up the connection to the
    // database (so you don't need to reopen the connection
    // again on the same page).
    $ms = mysql_pconnect($host, $user, $pass);
    if ( !$ms )
    {
    echo "Error connecting to database.\n";
    }
     
    // Then you need to make sure the database you want
    // is selected.
    mysql_select_db($db);

When I do that the only thing I see is:
Error: User not added to database.

ps. I think that it's my WAMP server that isn't fully on since it's yellow, probably SQL is offline?

Thanks in advance! :)

Depending on where your dbconfig file is saved, you may want to change:

include ("/dbConfig.php");

to:

include ("dbConfig.php");

If your connection to the database is rejected, it's either your include line, or your sql connect information is wrong.

Member Avatar for diafol

seems that your problem is that you can't connect with those details, so any calls to mysql_ functions will also throw an error. Check your connection details. Try it from phpmyadmin or your favourite mysql GUI.

**If WAMP shows yellow - it probably means something bad. I use XAMPP, so I can't really comment, but do you have to manually start the mysql server? E.g. by clicking a button?

dbConfig.php is placed with the other files but I can make it skip the problem by adding the information directly into register.php and forget the dbconfig.php

but the error after the registration still exists. I think it's WAMP.

It usually starts by itself, but I can do it manually by pressing "Start all services"
Which includes php and mysql. At the loading point it doesn't turn green, just yellow which is half the services on.

Maybe a conflicting port? I am able to access my db on another computer using my WAN ip and the port 3306.

Member Avatar for diafol

Does phpmyadmin work?

No..


Welcome to phpMyAdmin

Error
MySQL said:

#1045 - Access denied for user 'root'@'localhost' (using password: NO)

phpMyAdmin tried to connect to the MySQL server, and the server rejected the connection. You should check the host, username and password in your configuration and make sure that they correspond to the information given by the administrator of the MySQL server.

Member Avatar for diafol

OK, I'm still no better off. You're not using a PW, which I believe is the default setting anyway. root is the default username. localhost should be the default host. 3306 the default port.

Did you change any of those settings on WAMP install?

Well, for mysql I do have a password, and the rest is localhost and root.
I left everything as it was, simply clicked next next next, done.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.