Welcome To Snipplr
Everyone's Recent PHP Snippets Tagged query
- All /
- JavaScript /
- HTML /
- PHP /
- CSS /
- Ruby /
- Objective C
In Laravel you can use "IN" query as
Using Eloquent
$data = YourModel::whereIn('id', array(1, 2, 3))->get();
Using DB Query builder
$data = DB::table('your_table')->whereIn('id', array(1, 2, 3))->get();
0
5262
posted 5 years ago by interviewqueries
If you need to get the whois information for a specific domain, why not using PHP to do it? The following function take a domain name as a parameter, and then display the whois info related to the domain.
1
917
posted 12 years ago by o0110o
Snippet to show a simple use of the transient API when querying posts.
0
863
posted 12 years ago by Mat_
Function to prevent sql injection in Like queries, where the characters '_' and '%' can be dangerous.
0
1102
posted 12 years ago by TimoZachi
This function allow you ti have multiple parameters in your query string.
Ex : id=12&name=Doe&id=42&nickname=Monster
0
858
posted 12 years ago by MonsterDev
Takes your table name and key=>value array of values and returns the text for inserting into a MySQL database. Automatically surrounds strings with single quotes.
1
1086
posted 12 years ago by lemcoe9
To use:
$update_sql = querys($sql);
or
$select_sql = getresult($sql);
Used simplify selecting rows from a database. You'll need to pass in the SQL statement.
0
781
posted 14 years ago by shawntysco
Uses action hook of the hybrid theme framework to launch function that modifies the query on the archive page for category 6.\\r\\n\\r\\nSorts by the custom field \\\"event_date\\\" and compares it to the current date.\\r\\n\\r\\nBased on [goto11\\\'...
0
807
posted 14 years ago by hussong