1. Connection query (join)
A join query refers to a query that associates two or more tables together to obtain data that matches rows from another table. Common connection queries include internal connections (equivalent connections), left (outer)
Laravel is the PHP Web development Framework (PHP Web framework). It frees you from messy code, it helps you build a perfect web app, and every line of code can be concise and expressive. So, how does the Laravel framework operate the database?
Queries Builder (query Builder)
1. New data
You can insert one/more data by using the Insert method of the Query Builder:
Db::table (' users ')->insert ([
[' ID ' =>1, ' name ' => ' laravel ', ' email ' => ' laravel@test.com ', ' password ' => '
Original address: http://blog.onlywan.cc/14843810761202.html Laravel Eloquent use of small notes
Today, because of the need to develop a database business middle tier, we started to study laravel eloquent, because when we first started using the
1. Connection query (join)
A connection query is a query that associates two or more tables together to get data that matches the rows of one table with the rows of another. Common connection queries include inner joins (equivalent connections),
With the Debugbar debugging tool installed for the Laravel project, a toolbar opens at the bottom of the page in debug mode, where you can view performance statistics and, most importantly, print the SQL statements and debug content that the page
Laravel: only one statement is used to identify the number of data entries corresponding to different conditions in a table: {code ...} it is concluded that the number of sex is 1 and age is 2, the number of sex is 1 and age is 5, and the number of
One, selects retrieve all rows in the table
$users = db::table (' users ')->get ();
foreach ($users as $user)
{
var_dump ($user->name);
}
retrieving a single row from a table
$user = db::table (' users ')->where (' name ', ' John ')->first
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.