Replace
$result = mysql_query("Insert into table1(Username,Password,Role) values (Username='$username', Password='$password',Role='$role') ",$con);
with
$result = mysql_query("Insert into table1(`Username`,`Password`,`Role`) values ('$username', '$password','$role') ",$con);
You don't have to assign the value to the column on your INSERT query as you have done. Just map the values as shown above.
Apart from the above issues... Dissecting your code ..
The main issue with your code is you are doing an INSERT but you are expecting a resultset as you have done a SQL SELECT which is wrong.
You need to change your code like this..
The below code is just an illustration to tell you what you had done was actually wrong. Do not use this code ! You first need to migrate to the latest database API provided for you in the side note section.
$db_select = mysql_select_db('my_db', $con);
if(isset($_GET['username'],$_GET['password'],$_GET['role']))
{
$username = mysql_real_escape_string($_GET['username']);
$password = mysql_real_escape_string($_GET['password']);
$role = mysql_real_escape_string($_GET['role']);
$result = mysql_query("Insert into table1(`Username`,`Password`,`Role`) values ('$username', '$password','$role') ",$con);
if (!$result)
{
die (mysql_error());
}
else
{
echo "Record Inserted";
}
mysql_close($con);
}
SideNote
The (mysql_*) extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead,the MySQLi or PDO_MySQL extension should be used. Switching to PreparedStatements is even more better to ward off SQL Injection attacks !