如何在php中生成查询错误

i have a query that doesn't seem to be executing for some reason. I've checked all the vars are the right names, that they all have the right data in them but for some reason it just won't fire.

Now i know there is a way to generate the error but i can't remember or find it on the internet. I'm using mysqli to run the query are this is the code for the query:

$stmt = $this->conn->query("INSERT INTO seminar_signup(email, firstname, surname, address_1, address_2, postcode) VALUES ('$san_email', '$san_firstname', '$san_surname', '$san_address1', '$san_address2', '$san_postcode')");

I've more or less copied the code from another function that does close to the same thing and that works fine.

thanks for the help.

Maybe this: mysqli error

$stmt = @$this->conn->query("INSERT INTO seminar_signup(email, firstname, surname, address_1, address_2, postcode) VALUES ('$san_email', '$san_firstname', '$san_surname', '$san_address1', '$san_address2', '$san_postcode')");

echo mysql_error();
$stmt = $this->conn->query("INSERT INTO seminar_signup(email, firstname, surname, address_1, address_2, postcode) VALUES ('$san_email', '$san_firstname', '$san_surname', '$san_address1', '$san_address2', '$san_postcode')") or die(mysql_error());

First check the connection is it opened

then get the sql query by echo which is going to execute in your query function of $this->conn, and execute it in your phpmyadmin or what ever GUI you have.

try to $stmt = $this->conn->query("INSERT INTO seminar_signup(email, firstname, surname, address_1, address_2, postcode) VALUES ('".$san_email."', '".$san_firstname."', '".$san_surname."', '".$san_address1."', '".$san_address2."', '".$san_postcode."')");