Interval query $ data [& amp; #39; id & amp; #39;] array (& amp; #39; gt & amp; #39;, 4 ), array (& amp; #39; lt & amp; #39;, 10); // The default relationship is (and) and the link // SELECT * FROM 'TP _ user' W...
Interval query
- $ Data ['id'] = array ('GT ', 4), array ('Lt', 10); // The default relationship is (and) and
- // SELECT * FROM 'TP _ user' WHERE ('id'> 4) AND ('id' <10 ))
-
- $ Data ['id'] = array ('GT ', 4), array ('Lt', 10), 'OR') // The link is (or) or relationship
-
- $ Data ['name'] = array ('like', '% 100'), array ('like',' %
% '), 'Gege',' or ');Multiple arrays can be added to the array. if there is no or, the relationship is "and" by default.
Statistics Query
- Count // Obtain the number
- Max // obtain the maximum number
- Min // obtain the minimum number
- Avg // Obtain the average
- Sum // get the sum
- $ M = M ('user ');
- $ Arr = $ m-> count (); // obtain the total number of users.
- $ Arr = $ m-> where ("username = 'gege'")-> count (); // place the string
-
- $ M = M ('user ');
- $ Data ['username'] = 'gege'; // place an array
- $ C = $ m-> where ($ data)-> count (); // The array operation is more standard.
You can use SQL to directly query and perform more operations flexibly.
A. The primary number of queries processes the data read. The result set is returned successfully. if the query fails, the return value is boolean false.
- $ M = M ();
- $ Result = $ m-> query ("select * from tp_user where id> 50 ");
- Var_dump ($ result );
B. execute is used to update write operations. if a write operation is successful, the number of affected rows is returned. if a write operation fails, the return value is boolean false.
- $ M = M ();
- $ Result = $ m-> execute ("insert into tp_user ('Username') values ('ztz3 ')");
- Var_dump ($ result );