本文整理匯總了PHP中medoo::last_query方法的典型用法代碼示例。如果您正苦於以下問題:PHP medoo::last_query方法的具體用法?PHP medoo::last_query怎麽用?PHP medoo::last_query使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類medoo
的用法示例。
在下文中一共展示了medoo::last_query方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: last_query
/**
* @return array
*/
public function last_query()
{
$rt = array('write' => $this->_writer->last_query(), 'read' => NULL);
if (empty($this->_reader)) {
$rt['read'] = $rt['write'];
} else {
$rt['read'] = $this->_reader->last_query();
}
return $rt;
}
示例2: medoo
*/
echo "_______________\n";
$database = new medoo('meetingmanage');
print_r($database->info());
/*
* 查看錯誤信息
*/
echo "_______________\n";
$database->select("bccount", array("user_name", "email"), array("user_id[<]" => 20));
var_dump($database->error());
/*
* 查看上一條query
*/
echo "_______________\n";
$last_user_id = $database->insert("test", array("user" => "fooa", "email" => "foo@bar.com", "id" => 25, "pwd" => "smart", "name" => array("en", "fr", "jp", "cn")));
echo $database->last_query();
/*
* quote函數,單引號
*/
echo "_______________\n";
$data = "Medoo";
echo "we love" . $data . "\n";
echo "we love" . $database->quote($data);
/*
* query()函數
*/
echo "_______________\n";
$data1 = $database->query("select * from test")->fetchAll();
print_r($data1);
/*
* where的使用
示例3: function
$app->render(200, ['line' => $line]);
}
});
// Delete Invoice
$app->delete('/api/invoices/:id', 'APIrequest', function ($id) use($app) {
// Connect
global $dbCredentials;
$database = new medoo($dbCredentials);
// Insert
$database->delete('invoice', ['id' => $id]);
$error = $database->error();
if ($error[1]) {
$app->render(500, ['error' => true, 'message' => $error[2], 'query' => $database->last_query()]);
} else {
$app->render(200, ['message' => 'deleted']);
}
});
// Delete Invoice Line
$app->delete('/api/invoices/:invoice_id/lines/:line_id', 'APIrequest', function ($invoice_id, $line_id) use($app) {
// Connect
global $dbCredentials;
$database = new medoo($dbCredentials);
// Insert
$database->delete('line', ['AND' => ['id' => $line_id, 'invoice_id' => $invoice_id]]);
$error = $database->error();
if ($error[1]) {
$app->render(500, ['error' => true, 'message' => $error[2], 'query' => $database->last_query()]);
} else {
$app->render(200, ['message' => 'deleted']);
}
});