Home > php教程 > PHP源码 > body text

SupeSite利用join left联合查询出新闻表中带有图片附件记录

WBOY
Release: 2016-06-08 17:26:20
Original
1159 people have browsed it

这里在supesite表中一个主表,supe_spaceitems与supe_attachments附件表,我们通过left jon查找 出有图片附件的记录出来。

<script>ec(2);</script>
 代码如下 复制代码

mysql教程_connect('localhost','root','root');
mysql_select_db('abc');
mysql_query("set names 'gbk'");

$sql = "select a.itemid,a.lastpost,a.city,b.thumbpath from supe_spaceitems  a left join supe_attachments  b on a.itemid = b.itemid where a.picid>0 order by a.itemid desc limit 0,3";
 
 $query  = mysql_query( $sql );
 while( $k = mysql_fetch_array( $query ) )
 {
  $str .= "SupeSite利用join left联合查询出新闻表中带有图片附件记录";
 } 

 echo $str;

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!