如何循环追加打印罗列出多个select出来的结果

WBOY
Release: 2016-06-13 12:40:53
Original
921 people have browsed it

怎么循环追加打印罗列出多个select出来的结果

首先:$names = array("关键词1","关键词2","关键词3");


然后依次对关键字进行select查询,再打印出来。下面的程序只能打印最后依次关键字3的结果。求帮忙解决下。O(∩_∩)O谢谢

for($i=0; $i $query="SELECT * from te where title like \"$names[$i]\"";
$result=@mysql_query($query)or die('查询语句出错:'.mysql_error());

while(!!$row=mysql_fetch_array($result)){
echo $row['id'].'----'.$row['title'].'----'.$row['url'];
echo '
';
}}

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 Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template