1.11M Members

[2 Simple Problems]php and sql db

 
0
 

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! :)

 
0
 

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.

 
1
 

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?

 
0
 

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.

 
0
 

Does phpmyadmin work?

 
0
 

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.

 
0
 

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?

 
0
 

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.

 
0
 

Solved.

Question Answered as of 2 Years Ago by diafol and stoopkid
 
1
 

Have a look at this to change the PW:

http://www.kirupa.com/forum/showthread.php?279644-How-to-reset-password-in-WAMP-server

May be worth looking at windows task manager to see if mysql is running under processes or services tabs before you have a go at changing anything.

//EDIT

Great, mark the thread as solved (link below the edit box)

You
This question has already been solved: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: