0

I'm trying to trouble shoot a problem with a prepared statement using mysqli in PHP. Is there a way to output the query that is actually sent to the server? For example if the WHERE clause to the query is determined from user input, is there a way to see the actual query generated containing the value from the WHERE clause after it's been sanitized? Let me know if the question isn't clear and I'll explain better.

So when mysqli_stmt_execute($finalQuery); callled, I want to see the query.

1 Answer 1

0

mysqli_info will return info on the last executed query.

http://php.net/manual/en/mysqli.info.php

$link = mysqli_connect("localhost", "my_user", "my_password", "world");

// Stuff to setup query...
$finalQuery = mysqli_prepare($link, $finalQuery);
mysqli_stmt_execute($finalQuery);

var_dump(mysqli_info($link));

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.