0

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.

2
  • What kind of object is $this -> conn? A MySQLi instance? A PDO instance? A custom-built object that extends one of the above objects? A custom-built object that doesn't extend either of the above? Commented Mar 12, 2012 at 10:46
  • You have a query, try it directly on MySQL, you just need to replace dummy data in that variables Commented Mar 12, 2012 at 10:48

6 Answers 6

1

Maybe this: mysqli error

Sign up to request clarification or add additional context in comments.

Comments

1

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."')");

Comments

0
$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();

Comments

0
$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());

Comments

0

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

Comments

0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.