How to overcome the error Unknown database 'db1'?

I have written the following code in PHP :

<?php
$con=mysqli_connect('localhost','root');
if(!$con)
    echo "Connection Failed";``
mysqli_select_db($con,'db1') or die(mysqli_error($con));

$cname=$_POST['course'];
$dname=$_POST['dispname'];
$q="INSERT INTO material (cname,dname) VALUES ('$cname','$dname')";``
mysqli_query($con,$q) or die(mysqli_error($con));
?> 

Here database db1 is existing in wamp database and also material table is existing . Please help me to solve this problem!