I´m new in php programming and so i tried to connect my php file with an sql database. It´s working till i come to the point were i want to use a query and execute them. Can someone please help me why i always get "Error querying database"?
$query = "INSERT INTO user (surname, name, e-mail, password) VALUES ('$text', '$text2', '$text3', '$text4')";
    $query2 = "CREATE TABLE $text3 (
    name VARCHAR(30)  PRIMARY KEY, 
    password VARCHAR(30))";
    //make the query
    $result = mysqli_query($db, $query) or die('Error querying database.');
    $result2 = mysqli_query($db, $query2) or die('Error querying database1.');
I am defenitely connected with the database before.
My second question is the right use of the Create Table statement. I want to create a table which is named like the users E-mail address. Is this the right usage?
CREATE TABLE $text3 (
name VARCHAR(30)  PRIMARY KEY, 
password VARCHAR(30))";
I especially want to know if i need to set ' before the $text3 or not.
 
    