I need to create a table with the class name given by the user in my Android application. I tried to do it with following code but I get errors.
What's going wrong?
$con = mysqli_connect("mysql.hostinger.in","u975450189_****","********","u975450189_****");
$classname = $_POST["classname"];
$classid = $_POST["classid"];
$statement = mysqli_prepare($con, "CREATE TABLE ?(id int(20) AUTO_INCREMENT PRIMARY KEY,? VARCHAR(20) NOT NULL);");
mysqli_stmt_bind_param($statement, "ss", $classname, $classid);
mysqli_stmt_execute($statement);
$response = array();
$response["success"] = true;
print_r(json_encode($response));
Warning: mysqli_stmt_bind_param() expects parameter 1 to be mysqli_stmt, boolean given in /home/u975450189/public_html/ClassCreate.php on line 10
Warning: mysqli_stmt_execute() expects parameter 1 to be mysqli_stmt, boolean given in /home/u975450189/public_html/ClassCreate.php on line 11 {"success":true}