thinkphp questions about SQL queries

Source: Internet
Author: User
thinkphp problems with SQL queries
such as a table, if you want to query all the values of a single field how to write it, I know if the whole thing is

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

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

Well, if I just want to query all the values of the Name field under table, there's nothing on the manual, and there's nothing to find.


Another problem is that if you use statistical query results how to assign value to the foreground display, such as with $m->count (); Get the number of this table, with dump printed out on a value, do not know how to use what is displayed in the foreground.
------Solution--------------------
Reference:

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



I'm doing thinkphp now, too.
  • 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.