0

the first half of the code works fine, but the second half it is giving me that warning on the title, I just cant find why

        //first half
        $sql = "SELECT id, password FROM users WHERE username=?;"; 
        $stmt = mysqli_stmt_init($conn);
        mysqli_stmt_prepare($stmt,$sql);
        mysqli_stmt_bind_param($stmt, 's', $username);
        mysqli_stmt_execute($stmt);
        $result = mysqli_stmt_get_result($stmt);
        $row = mysqli_fetch_assoc($result);
        $id = $row["id"];
        mysqli_free_result($result);

        mysqli_stmt_close($stmt);

        //second half
        $sql = "CREATE TABLE ? (id int(11) NOT NULL AUTO_INCREMENT, noteId int(11), noteName varchar(255));";
        $stmt = mysqli_stmt_init($conn);
        echo(gettype($id));
        mysqli_stmt_prepare($stmt,$sql);

        //the next bind, execute and close are giving me the warning
        mysqli_stmt_bind_param($stmt,'i',$id);
        mysqli_stmt_execute($stmt);
        mysqli_stmt_close($stmt);
Lukas
  • 49
  • 2
  • 10

0 Answers0