THINKPHPsql query problems

Source: Internet
Author: User
THINKPHPsql query problems such as a table. if you want to query all the values of a single field, how can I write it?

$ M = M ('table'); $ result = $ m-> select (); $ this-> assign ('res', $ result );

// Then the foreground uses volist to loop out the $ res value.

If I only want to query all the values of the name field in the table, how can I write them? I didn't find them in the manual.


Another problem is how to assign a value to the front-end display of the statistical query results. for example, you can use $ m-> count () to get the number of tables, dump is used to print out a value. I don't know how to use it to display it at the front end.


Reply to discussion (solution)

$ M = M ('table'); $ result = $ m-> field ('name')-> select (); $ this-> assign ('res ', $ result );

$ M = M ('table'); $ result = $ m-> field ('name')-> select (); $ this-> assign ('res ', $ result );



As it turns out, I am also working on ThinkPHP

There was no such manual, but I did not find it after I searched it.

You didn't take a look.
Http://doc.thinkphp1.cn/manual/query.html

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.