The functions that are performed to check the response of this query are the query helper function when the query of the database is executed. Such as insertId, affectedrows, countall, getlastquery, getplatform, getversion and many more.
We use insertid function to fetch insert id.
$this->seller // database connection set
public function insert_rec()
{
$this->seller->table('users')
->insert([
'name' => 'deepak Tailor'
]);
echo $this->seller->insertID();
}
Displays the number of affected rows, when doing “write” type queries (insert, update, etc.).
public function insert_rec()
{
$this->seller->table('users')
->insert([
'name' => 'deepak Tailor'
]);
echo $this->seller->affectedRows();
}
The getlastQuery function is used to print the query by which type the query is being generated.
public function insert_rec()
{
$this->seller->table('users')
->insert([
'name' => 'deepak Tailor'
]);
echo $this->seller->getLastQuery();
}
public function check_result()
{
$query_str = "SELECT * FROM users WHERE id = ?";
$this->seller->query($query_str,'20');
echo $this->seller->getLastQuery();
}
To count how many rows are in a table, we use the countAll function.
public function check_result()
{
echo $this->seller->table('users')->countAll();
}
The database platform uses the getPlatform function to check.
public function check_result()
{
echo $this->seller->getPlatform();
}
The database version uses the getVersion function to check
public function check_result()
{
echo $this->seller->getVersion();
}
My name is Deepak tailor as a fullstack developer. I have been in the IT industry (PHP, Nodejs, flutter) for the last 5 years. For professional and customize web development & app development, you can send inquiry on our email.
----
You can contact him at deepaktailor10@yahoo.in