+ 1

About web design and php

Do we always write database configuration as: $dbOptions = array( 'db_host' => 'localhost', 'db_user' => 'username', 'db_pass' => 'password', 'db_name' => 'chat' ); Are the values in '' always same? If not then pls tell me about each value. And 'chat' is name of my database. Are my values correct?

25th Dec 2017, 6:38 AM
Shivam Mirje
Shivam Mirje - avatar
5 Answers
+ 2
Yes. db_host is your server host - which is you have mentioned here as localhost db_user is a username which you have provided at the time of your sql / mysql setup e.g. in phpmyadmin the common username is root db_pass is like above, is a password which you have provided at the time of your database setup (Note: if u provide blank password at that time, it should be blank here also) db_name' is your database name - which is chat here and that is correct.
25th Dec 2017, 8:01 AM
đŸ’»AmeyđŸ’»
đŸ’»AmeyđŸ’» - avatar
+ 2
If you are using xampp you can find it in xampp/phpmyadmin/config.inc open the file in text editor and you will see array of " $cfg['servers']", it's right there . like this - $cfg['servers'][$i]['user'] same for password $cfg['servers'][$i]['password']
25th Dec 2017, 9:16 AM
đŸ’»AmeyđŸ’»
đŸ’»AmeyđŸ’» - avatar
+ 2
Your welcome Shivam, I hope you are looking for exactly like this.:)
25th Dec 2017, 1:27 PM
đŸ’»AmeyđŸ’»
đŸ’»AmeyđŸ’» - avatar
+ 1
@Amey tysm for ur answer
25th Dec 2017, 1:26 PM
Shivam Mirje
Shivam Mirje - avatar
0
@ Amey Thanks for your answer But Where can i find db_user and db_pass values in my database?
25th Dec 2017, 8:09 AM
Shivam Mirje
Shivam Mirje - avatar