Closed khanhnam99 closed 1 year ago
By using the getLastQuery()
function.
$conn = new MysqliDb("localhost", "root", "root", "testDb"); // create new connection
$username = $conn->escape($_GET["username"]); // get username to get users by
$result = $conn->orderBy("id", "DESC")->where("username", "%" . $username . "%", "like")->get("users"); // get users from db
//print_r($result); // gives out our result
echo $conn->getLastQuery(); // gets last executed query in SQL format
This should be the proper way to use it. As an example, I selected a few users with a LIKE
and ORDER BY
condition. You can use whatever query and variable for the connection you want, just use, after execution of the query, the getLastQuery()
function.
I hope I was of help :)
Great! thanks
how show a sql query ?