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());
Try the same query directly on MySQL, If you still want to get errors in PHP following are the MySQLi functions to get last errors
mysqli::$errno — Returns the error code for the most recent function call
mysqli::$error_list — Returns a list of errors from the last command executed
mysqli::$error — Returns a string description of the last 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."')");