ZF Framework DB Class Select query Join list Use example

Source: Internet
Author: User
Tags foreach config join zend zend framework

  This article mainly introduces the ZF Framework's DB Class select query Join list Use example, the need for friends can refer to the following

The Zend framework's query join () list uses the example     code as follows: <?php//Introduce Loader class (Auto Load Class) require_once ("zend/loader.php"); Use the Loader class to introduce a Db class Zend_loader::loadclass ("zend_db"); Introducing the ZEND_DB state-Zend_loader::loadclass ("Zend_db_statement_pdo"); Configure database connection Information $Config = Array (' Host ' => ' 127.0.0.1 ',     ' username ' => ' root ',      ' Passwo Rd ' => ',      ' dbname ' => ' test ',     ' Profiler ' => ' true '    ; Tells the database and database configuration information that the zend_db class operates $Db = Zend_db::factory (' Pdo_mysql ', $Config); //EXECUTE encoded statements   $Db-> query ("Set Names UTF8 "); -----------------------------------------------$Select = $Db->select (); $Select-> from (' Sanguo ', ' * '); $Select-> Join (' Dengji ', ' Sanguo.s_dengji = dengji.d_id '); $Select-> Order (' S_dengji asc '); $Reslut = $Db-> fetchall ($Select); echo "<table border= ' 1 ' width= ' style= ' text-align:center ' >"; foreach ($Reslut as $key => $value)   { echo "<tr>";  foreach($value as $key 2 => $value 2)    {  echo "<td>". $value 2. "</td>"; &NBSP}  echo "</tr>"; echo "</table>";?>  

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.