如何使用PHP编码设置数据库连接以及保存该文件的位置?

I am having some problems with php coding i have written php coding correct but it is not working,it is giving an error that "The Object not found" in browser.

Hey guyz please help me i am stuck on this and tried every possible thing to make this coding work.

Thanks

you can save the file in any folder but it is advisable for u to save it in where all your files are kept for a quick reference. below is php code for setting up database:

$con=mysqli_connect("host","user","password") or die(mysqli_error());
mysqli_select_db($con,"yourdatabasename");

Note: host=localhost(if wamp or xampp is used) or your domain name(like www.google.com) You can save dis php file with any name e.g config.php. user= username of your database used in your phpmyadmin. likewise your password. If you are using wamp or xampp, use dis format: $con=mysqli_connect("locahost","root","") or die(mysqli_error());

First php is not supported by itself in browser, you need a server to run php,you can use a localhost server like wamp, create DB in phpMyAdmin panel with the desired username and password then you can connect to it from your classes.

$this->host="localhost";
$this->username="root";
$this->password="";
$this->database="dbname";
$con=mysql_connect($this->host,$this->username,$this->password) or die(mysql_error());
$res=mysql_select_db($this->database,$con)or die(mysql_error());