alexandre Posted October 31, 2022 Share Posted October 31, 2022 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. Quote Link to comment https://forums.phpfreaks.com/topic/315476-why-do-my-database-name-is-not-updated-even-after-update-of-the-file/ Share on other sites More sharing options...
gw1500se Posted October 31, 2022 Share Posted October 31, 2022 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. Quote Link to comment https://forums.phpfreaks.com/topic/315476-why-do-my-database-name-is-not-updated-even-after-update-of-the-file/#findComment-1602082 Share on other sites More sharing options...
alexandre Posted October 31, 2022 Author Share Posted October 31, 2022 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 .. Quote Link to comment https://forums.phpfreaks.com/topic/315476-why-do-my-database-name-is-not-updated-even-after-update-of-the-file/#findComment-1602083 Share on other sites More sharing options...
gw1500se Posted October 31, 2022 Share Posted October 31, 2022 (edited) Then it must be a permissions issue resulting from the change. Check the httpd/error log. Edited October 31, 2022 by gw1500se Quote Link to comment https://forums.phpfreaks.com/topic/315476-why-do-my-database-name-is-not-updated-even-after-update-of-the-file/#findComment-1602084 Share on other sites More sharing options...
ginerjm Posted October 31, 2022 Share Posted October 31, 2022 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". Quote Link to comment https://forums.phpfreaks.com/topic/315476-why-do-my-database-name-is-not-updated-even-after-update-of-the-file/#findComment-1602085 Share on other sites More sharing options...
alexandre Posted October 31, 2022 Author Share Posted October 31, 2022 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'; $DATABASE_PASS = ''; $DATABASE_NAME = ''; mysqli_report(MYSQLI_REPORT_ERROR|MYSQLI_REPORT_STRICT); $con = mysqli_connect($DATABASE_HOST, $DATABASE_USER, $DATABASE_PASS, $DATABASE_NAME); 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 Quote Link to comment https://forums.phpfreaks.com/topic/315476-why-do-my-database-name-is-not-updated-even-after-update-of-the-file/#findComment-1602087 Share on other sites More sharing options...
alexandre Posted October 31, 2022 Author Share Posted October 31, 2022 1 hour ago, gw1500se said: Then it must be a permissions issue resulting from the change. Check the httpd/error log. sorry but i never heard of http/error log is this something i am capturing with this error code in the file above? Quote Link to comment https://forums.phpfreaks.com/topic/315476-why-do-my-database-name-is-not-updated-even-after-update-of-the-file/#findComment-1602088 Share on other sites More sharing options...
alexandre Posted October 31, 2022 Author Share Posted October 31, 2022 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 Quote Link to comment https://forums.phpfreaks.com/topic/315476-why-do-my-database-name-is-not-updated-even-after-update-of-the-file/#findComment-1602090 Share on other sites More sharing options...
gw1500se Posted October 31, 2022 Share Posted October 31, 2022 Yep. There you go. It is a permissions error or wrong password for root or root is the wrong MySQL user for that database. Quote Link to comment https://forums.phpfreaks.com/topic/315476-why-do-my-database-name-is-not-updated-even-after-update-of-the-file/#findComment-1602092 Share on other sites More sharing options...
ginerjm Posted October 31, 2022 Share Posted October 31, 2022 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. Quote Link to comment https://forums.phpfreaks.com/topic/315476-why-do-my-database-name-is-not-updated-even-after-update-of-the-file/#findComment-1602093 Share on other sites More sharing options...
alexandre Posted October 31, 2022 Author Share Posted October 31, 2022 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. Quote Link to comment https://forums.phpfreaks.com/topic/315476-why-do-my-database-name-is-not-updated-even-after-update-of-the-file/#findComment-1602098 Share on other sites More sharing options...
alexandre Posted October 31, 2022 Author Share Posted October 31, 2022 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 ? Quote Link to comment https://forums.phpfreaks.com/topic/315476-why-do-my-database-name-is-not-updated-even-after-update-of-the-file/#findComment-1602099 Share on other sites More sharing options...
ginerjm Posted October 31, 2022 Share Posted October 31, 2022 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 Quote Link to comment https://forums.phpfreaks.com/topic/315476-why-do-my-database-name-is-not-updated-even-after-update-of-the-file/#findComment-1602100 Share on other sites More sharing options...
alexandre Posted October 31, 2022 Author Share Posted October 31, 2022 (edited) 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 October 31, 2022 by alexandre Quote Link to comment https://forums.phpfreaks.com/topic/315476-why-do-my-database-name-is-not-updated-even-after-update-of-the-file/#findComment-1602101 Share on other sites More sharing options...
ginerjm Posted October 31, 2022 Share Posted October 31, 2022 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. Quote Link to comment https://forums.phpfreaks.com/topic/315476-why-do-my-database-name-is-not-updated-even-after-update-of-the-file/#findComment-1602103 Share on other sites More sharing options...
alexandre Posted October 31, 2022 Author Share Posted October 31, 2022 (edited) the only database names present are the default ones and my new database Edited October 31, 2022 by alexandre Quote Link to comment https://forums.phpfreaks.com/topic/315476-why-do-my-database-name-is-not-updated-even-after-update-of-the-file/#findComment-1602104 Share on other sites More sharing options...
ginerjm Posted October 31, 2022 Share Posted October 31, 2022 (edited) So is your 'missing' database name there???? And what are the "default" ones? My host has only one 'default' db named "information_schema". I am curious what other default ones you have. Edited October 31, 2022 by ginerjm Quote Link to comment https://forums.phpfreaks.com/topic/315476-why-do-my-database-name-is-not-updated-even-after-update-of-the-file/#findComment-1602106 Share on other sites More sharing options...
alexandre Posted October 31, 2022 Author Share Posted October 31, 2022 (edited) 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 October 31, 2022 by alexandre Quote Link to comment https://forums.phpfreaks.com/topic/315476-why-do-my-database-name-is-not-updated-even-after-update-of-the-file/#findComment-1602107 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.