I need to drop the database by passing the values of a and b in the giving below code
I have set the value of a as 5 for first level testing and b to give the database name
i.e., index.php?a=5&b=test
<?php
include ('config.php');
$a=$_GET["a"];
$b=$_GET["b"];
if ($a==5)
{
$sql = 'drop database'.'$db';
if (mysql_query($sql))
{
echo "Database test was successfully dropped\n";
}
else
{
echo 'Error dropping database: ' . mysql_error() . "\n";
}
}
{
echo "Not Success";
}
?>
I am getting the Error
Error dropping database: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'databasee$db' at line 1 Not Success
I know that i can't drop the database by mysql query in php
Error Dropping Database (Can't rmdir '.test\', errno: 17)
The error is by contatinating the database name in the code
$sql='drop database'.'$b';
How can i do this ?