search
  • Sign In
  • Sign Up
Password reset successful

Follow the proiects vou are interested in andi aet the latestnews about them taster

2 answers
Q&A Regarding the problem of repeatedly executing sql
Regarding the problem of repeatedly executing sql
麦子 2021-11-28 20:34:05 Views 1215
PHP

0

Db:table('shop_goods')->count();

Here I executed one more Db query to query the total number of paging. I feel that the query efficiency is affected. Can I compare it with the query data set results? Share one? Just execute Db:table('shop_goods') once.

Your Answer
submit

2 answers
0

Yes, it just depends on how you like to use it

2021-11-29 10:41:15

Boss, please write a code explanation.

一粒麦子 2021-11-29 10:49:37

submit

0

Didn’t you take out the result set directly? Check the length of the result set directly, and then divide it by how many pages are divided into. Once divided, the number of pages will come out. If it’s troublesome for you, just use the method provided by tp

2021-11-29 10:56:24

Yes, but if the result set is conditionally filtered, for example, there are 10 pieces of data in total, and there are only 3 pieces after filtering, then the length of the output result set is 3, which is wrong~

一粒麦子 2021-11-29 21:49:51

submit

Popular tool

vc9-vc14 (32+64 bit) runtime library collection (link below)

vc9-vc14 (32+64 bit) runtime library collection (link below)

Download the collection of runtime libraries required for phpStudy installation

VC9 32-bit

VC9 32-bit

VC9 32-bit phpstudy integrated installation environment runtime library

PHP programmer toolbox full version

PHP programmer toolbox full version

Programmer Toolbox v1.0 PHP Integrated Environment

VC11 32-bit

VC11 32-bit

VC11 32-bit phpstudy integrated installation environment runtime library

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use