You can try these steps for a database connection to MySql
Step 1
create a connection to the server (localhost)
$con=mysql_connect("localhost","usrname","password")or die("couldn't connect to the server");
step2
Select which database to choose from
$db=mysql_select_db("kgsearchdb",$con)or die("couldn't select database");
step 3
create any sql statement for deletion updation or insertion
$sql="select VchUsername from tbUsers where VchUsername='$txtusrname'";
$sql1="insert into tablename(field_names) values(field_values)";
$sql="update tablename set fieldname=newvalue where condition";
$sql1="delete from tablename where condition";
step 4
create a resultset and excecute the query
$result=mysql_query($sql1,$con)or die("couldn't execute the query");
step 5
to get the values
$row=mysql_fetch_array($result1);
now $row contains the rows of the selected result
$row[0],$row[1] etc gives the values
use while loop to fetch all the datas
hope this will help you