Jump to content

why do my database name is not updated even after update of the file.


Recommended Posts

i restarted a database and updated my db connection file which connect to the database but for some reason i get this error: Fatal error: Uncaught mysqli_sql_exception: Unknown database 'phplogin' in C:\xampp2\htdocs\container\phplogin\registration\connect_db2.php:8 Stack trace: #0.

i emptied my cookies from any time and it still doesnt update. it is reading the old database name, the one i lost after uninstalling but i did not made the erase of the htdocs folder. i dont know if it might be a problem but the new xamp is installed in another folder in the same directory so i wonder if it might be the issue.. apart of that i know for sure that the database exist and the name is spelled right so this isnt the issue here.

Link to comment
Share on other sites

7 minutes ago, gw1500se said:

You need to show your code but off hand I would say that there is no database named 'phplogin'. I'm guessing that is a table name and the database itself is named something else.

as i said phplogin was the name of the previous database from before i uninstalled xamp because i had locked my root user account...

the name is updated to my actual db name in my databse connection file that i use on every pages so it should normally work but it isnt ..

Link to comment
Share on other sites

47 minutes ago, ginerjm said:

Have you run some sql to list out the databases that ARE defined?  Is this the only database name that you are missing?  Try "Show Databases".

i completely started over in a new folder after uninstalling so unless there is something in the config that have stayed the same as before and is defining my variable DATABASE_NAME  as my previous database name, i dont see what could do that.. 

$DATABASE_HOST = 'localhost';
$DATABASE_USER = 'root';

if (mysqli_connect_errno()) {
	// If there is an error with the connection, stop the script and display the error.//
	exit('Failed to connect to MySQL: ' . mysqli_connect_error());

this is my db connection file everything was working fine before i messed up my database and now it is acting as if there was cookies keeping this wrong name 

Link to comment
Share on other sites

i guess the error log that gets the closest to your definition seems like this :

[Mon Oct 31 11:09:58.158903 2022] [ssl:warn] [pid 16932:tid 420] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Mon Oct 31 11:09:58.483892 2022] [ssl:warn] [pid 16932:tid 420] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Mon Oct 31 11:09:58.738894 2022] [mpm_winnt:notice] [pid 16932:tid 420] AH00354: Child: Starting 150 worker threads.
[Mon Oct 31 12:09:02.998050 2022] [php:error] [pid 16932:tid 1908] [client ::1:61307] PHP Fatal error:  Uncaught mysqli_sql_exception: Access denied for user 'root'@'localhost' (using password: YES) in C:\\xampp2\\htdocs\\container\\phplogin\\registration\\connect_db2.php:8\nStack trace:\n#0 C:\\xampp2\\htdocs\\container\\phplogin\\registration\\connect_db2.php(8): mysqli_connect('localhost', 'root', '', 'phplogin')\n#1 C:\\xampp2\\htdocs\\container\\phplogin\\registration\\register.php(3): include('C:\\\\xampp2\\\\htdoc...')\n#2 {main}\n  thrown in C:\\xampp2\\htdocs\\container\\phplogin\\registration\\connect_db2.php on line 8, referer: http://localhost/container/phplogin/registration/register.html


Link to comment
Share on other sites

1 hour ago, ginerjm said:

So since you did not do as I asked I'm guessing that the issue is not a 'missing dbname' but rather your db connection.  I thought it was something else.

the problem doesnt seem to come from the name but effectively from the connection,  just as if the server was trying to connect to the new database with the previous name kept in cache or something, because the name i put in DATABASE_NAME is the correct and the database exist i just created it but couldnt register the first user using my register page. so i changed the connection file to the right database info but it never changed anything.

Link to comment
Share on other sites

1 hour ago, gw1500se said:

Yep. There you go. It is a permissions error or wrong password for root or root is the wrong MySQL user for that database.

would it be posible that since i did not delete the previous database htdocs folder and since i am using the same user login info it might interfere between the two instances ?

Link to comment
Share on other sites

I am not following you.    Can you make a connection or not?  And if you can make that connection can you run the simple query I asked for to tell me what database names you DO HAVE?  A simple yes or no could be all you have to say here, and not repeat my whole post

Link to comment
Share on other sites

i honestly dont know where you want me to do this query.. i am connected on phpmyadmin and i can do whatever i want but when it comes to connect via php this is where it is using the previous database name for no reason apparently. and i jut did the query in the sql section and it is showing my actual database.

Edited by alexandre
Link to comment
Share on other sites

27 minutes ago, ginerjm said:

If you have phpadmin then simplyy run the query I gave you right there.  Simply type in 'show databases' in phpadmin's query window and let's see if your 'missing' database name is present.

i am so stupid sometimes .... i simply didnt reopened the new folder in my workspace so i was updating the old files ....

and thank you for your devotiuon , i appreciate.

Edited by alexandre
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.